1837751 Members
3499 Online
110118 Solutions
New Discussion

Deleting crazy directory

 
Alexandre W. Agostini_1
Occasional Advisor

Deleting crazy directory

Hi fellows!

This one is for the clever and smart HP-UXers...

I have a directory which structure seems to be quite messy. I can't remove it, since it complains about not being empty. I can't remove the file's inside it either.

It seems that some ingenious user managed to send a windows directory to my HP box. :)

But the real chalenge is that I can't use the obvious fsck to try to fix it, since the filesystem cannot be dismounted (at least in near future).

Anyone knows a filesystem tool capable of do the trick?

Thank you all!
Alexandre.
7 REPLIES 7
Jeff Schussele
Honored Contributor

Re: Deleting crazy directory

Hi Alexandre,

Go into that dir & do a
rm -i *
and answer yes to all the files. You probably have a file in there with unprintable characters. Then when it's empty you ought to be able to remove the directory.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
MarkSyder
Honored Contributor

Re: Deleting crazy directory

If it's Windows files it's possible you can't delete them because they've got spaces in the filenames. I've encountered this many times and the solution is simple:

Say for example you want to delete "file one". "rm file one" will fail because of the space but "rm fil*" will work.

Make sure you've got rm aliased to "rm -i" in case rm removes files you want to keep.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Govind_3
Regular Advisor

Re: Deleting crazy directory

go into the directory and do
\rm -rif *
then cd ..
and \rm -rf directory name

-Goodluck
Govind
ramkumar
Valued Contributor

Re: Deleting crazy directory

need not to worry .this directory might be mounted using cifs . try with a command

# fuser -u C /
if will give the users using it now try to unmount that particular widowns directory only . the guy might mount the the directory with in
a mounted directory .
try to see any cifs related dameons are running or not .

thanks
Kent Ostby
Honored Contributor

Re: Deleting crazy directory

Another thing to try is:

find . -xdev -print -exec ll -i {} \;

If this shows an inode number of say "674" in the first column then you could follow up with:

find . -inum 674 rm {} \;

Best regards,

Kent Ostby


"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Alexandre W. Agostini_1
Occasional Advisor

Re: Deleting crazy directory


Hehe, I apreciate the prompt responses. But I'm afraid my case is a little complicated.

Some facts:

1. rm variations don't work 'cause there's no file to remove. It exists only in the squizofreninc structure of the directory.

2. That's also why taking the inode fails.

3. I believe that a fsck should fix it, I can't umount the directory so can't fsck it, can I?

4. Smart FTP clients also get trapped by the 'ghost file'.

Any sugestions?
mario ferrari
New Member

Re: Deleting crazy directory

I suppose you also followed the suggestion about fuser -cu directory_name.

Please try to see if it's in /etc/xtab, also.

Regards,
Marco