Removing Weird Directory

Removing Weird Directory

Post by Mark Olber » Mon, 18 Oct 1999 04:00:00



I know this isn't a networking question, but...

I accidentally created a directory called '-h' (minus the quotes)...
and I've discovered that you can't do:

Quote:> rm -r -h

because the rm command thinks the -h argument is actually an invalid
option flag!

So how do I get rid of this directory? Or do I just live with it as a
reminder that I should check my inputs before pressing RETURN...
<grin>

- Mark

 
 
 

Removing Weird Directory

Post by Mike Crai » Mon, 18 Oct 1999 04:00:00



> I know this isn't a networking question, but...

> I accidentally created a directory called '-h' (minus the quotes)...
> and I've discovered that you can't do:

> > rm -r -h

> because the rm command thinks the -h argument is actually an invalid
> option flag!

> So how do I get rid of this directory? Or do I just live with it as a
> reminder that I should check my inputs before pressing RETURN...
> <grin>

> - Mark

rm -r /-h

 
 
 

Removing Weird Directory

Post by Mark Olber » Mon, 18 Oct 1999 04:00:00


And the winner is Peter! Thanx!

Quote:>  rm -f ./-h

the above didn't work

Quote:>  rm -f -- -h

but this one did!

- Mark

 
 
 

Removing Weird Directory

Post by Mark Olber » Mon, 18 Oct 1999 04:00:00


Quote:>rm -r /-h

Nope, tried that, it doesn't work:  it wants to find an entry called
'/-h'

- Mark

 
 
 

Removing Weird Directory

Post by Mark Olber » Mon, 18 Oct 1999 04:00:00


Quote:>rm -r '-h'
>rm -r ?h

Nope, neither of those worked, either!

- Mark

 
 
 

Removing Weird Directory

Post by William Watso » Mon, 18 Oct 1999 04:00:00


rm -r -- -h

- bill


> I know this isn't a networking question, but...

> I accidentally created a directory called '-h' (minus the quotes)...
> and I've discovered that you can't do:

> > rm -r -h

> because the rm command thinks the -h argument is actually an invalid
> option flag!

> So how do I get rid of this directory? Or do I just live with it as a
> reminder that I should check my inputs before pressing RETURN...
> <grin>

> - Mark

 
 
 

Removing Weird Directory

Post by Peter T. Breue » Tue, 19 Oct 1999 04:00:00


: I accidentally created a directory called '-h' (minus the quotes)...
: and I've discovered that you can't do:

:> rm -r -h

: because the rm command thinks the -h argument is actually an invalid
: option flag!

FAQ. See the unix FAQ. See the linux FAQ too come to that.

  rm -f ./-h
or
  rm -f -- -h

Peter

 
 
 

Removing Weird Directory

Post by Bill Unr » Tue, 19 Oct 1999 04:00:00



Quote:>I accidentally created a directory called '-h' (minus the quotes)...
>and I've discovered that you can't do:
>> rm -r -h

rm -r '-h'
rm -r ?h
(making sure thta there is no other file starting with a single letter
and ending with h. ls ?h should tell you)
 
 
 

Removing Weird Directory

Post by Bill Unr » Tue, 19 Oct 1999 04:00:00



Quote:>>rm -r /-h
>Nope, tried that, it doesn't work:  it wants to find an entry called
>'/-h'

That's cause it was supposed to be
rm -r ./-h
 
 
 

Removing Weird Directory

Post by Peter T. Breue » Tue, 19 Oct 1999 04:00:00


: And the winner is Peter! Thanx!

OK, but ..

:>  rm -f ./-h

: the above didn't work

Sure it does! I forgot that you were wanting to remove a directory,
however, so it should have been rm -fr ./-h and rm -fr -- -h.

:>  rm -f -- -h

: but this one did!

Plus ump* million other alternatives!

Peter

 
 
 

1. Cannot remove a directory: Directory not empty

Hi there,

I am having trouble removing a couple of directories on 2 AIX systems.
When I attempt to remove the directory  it comes back with a message
directory not empty.

It seems there are no hidden files or directories inside the directory
I am trying to remove. I have used rm -rf "dirname", I have used find
./dirname -print -exec /bin/rm -i {} \; and it does not remove
anything.

The only way so far of removing the files is to unmount the
filesystems do an fsck, mount them back up and then remove the files.

The history of the files is that occasionally we find a file or
directory propagates itself and the directory length can reach around
901 characters in length, e.g.
/dataVolumes/jobdir/RIP/12345dir/12345dir/12345dir/12345dir/12345dir/12345dir/12345dir/12345dir/12345dir
...........and so on and so on. I attempt to do a recursive remove on
the 12345dir and it comes back with the messages directory not empty
on the bottom level directory. I then navigate to the last directory
in the tree and move it to the root directory. I can then do a
recursive remove from the first 12345dir, but the directory I moved to
the root directory still cannot be removed unless I unmount and run
fsck.

These directories are mounted on PCs via Samba and also mounted by
Macintosh using Helios Ethershare. My hunch is that the PC is somehow
causing the propagation because the user.group is nobody.nobody.

I have run sophos anti-virus software over the problem directories and
it does not find anything.

Again, how do I remove the directories without unmounting and then
running an fsck.

Thanks in advance,
Steve Withers
Customer Support
Creo
Meoburne Australia

2. How does newsreader find posted articles???

3. error: cannot remove <some directory> - directory not empty...

4. aspppd with cisco

5. Weird Ping, weird FTP, weird Telnet... HELP!!!

6. is SUN's implementation of MPI 5.0 multithreaded-safe?

7. Weird, weird, weird issue ....

8. Expected </Directory> but saw </Directory>

9. Removing weird files

10. Apache-1.3.3: weird directories

11. Weird ext2fs immortal directory bug

12. weird behaviour of Sessions directory on MediaTemple (dv) host

13. Weird ext2fs immortal directory bug (all-in-one)