How to kill a dir?

Wade Chandler wchandler at redesetgrow.com
Mon Jan 5 21:35:16 UTC 2004


not really if a directory doesn't have rm -fR or -Rf used on it, it must 
have rmdir used on it...hint though....rmdir won't work if the directory 
isn't empty.

Wade

WipeOut wrote:

> Brian Fahrlander wrote:
> 
>> On Mon, 2004-01-05 at 13:10, WipeOut wrote:
>>  
>>
>>> Quillen, Channon wrote:
>>>
>>>   
>>>
>>>> Try placing the directory name in quotes "" or single quotes ''
>>>> Eg. rm -fr "test"
>>>>
>>>> -Channon
>>>>
>>>>     
>>>
>>> Nope, that didn't help..
>>>
>>> Thanks for trying..
>>>   
>>
>>
>>    OK, time to get out the power tools. (I can't believe no one's
>> thrown this in already...)
>>
>>    ls -lai  <----notice that the 'i' is included. Sample:
>>
>>  Inum:   Perms                             Size, etc...
>> 968014 -rw-rw-r--    1 brian    brian     3885999 Dec 24 15:12 
>> ximian-artwork-0.2.26-1.i386.rpm
>> 968013 -rw-rw-r--    1 brian    brian      327381 Dec 24 15:11 
>> xmms-status-plugin-1.0-2.i386.rpm
>> 968015 -rw-rw-r--    1 brian    brian      320725 Dec 24 15:12 
>> xscorch-0.1.16-0.1pre2.i386.rpm
>> 968016 -rw-rw-r--    1 brian    brian      441488 Dec 24 15:12 
>> zsnes-1.36-3.i386.rpm
>>
>>    Find the directory/file by it's inode number, then
>>
>>    find . -inum 968016 -exec rm {} \;
>>
>>    If it's a directory, (and it's empty) whatever 'find' finds it'll
>> run the command on, such as removing the 'znes' rpm above.  As far as I
>> know, this'll work on any file or directory, unless the attributes are
>> changed (like in the previous posts, using chattr) or unless the thing's
>> a directory that isn't empty.
>>
>>    Enjoy!
>>
>>  
>>
> The result.. :)
> 
> [root at dev02 i386]# ls -lai
> ls: ??*?: Invalid or incomplete multibyte or wide character
> total 16
> 799767 drwxrwsr-x    3 root     root         4096 Jan  5 18:04 .
> 1665003 drwxrwsr-x    3 root     root         4096 Nov 12 07:03 ..
> 799769 drwxrwsr-x    2 root     root         8192 Jan  4 19:44 test
> [root at dev02 i386]# find . -inum 799769 -exec rm {} \;
> rm: cannot remove `./test': Is a directory
> find: ./??*?: No such file or directory
> 
> No joy..
> 
> Looks like I have found a weird one huh!!..
> 
> 






More information about the fedora-list mailing list