[Cialug] Unable to remove a directory in RedHat7

Matt Stanton matt at itwannabe.com
Fri Aug 22 16:24:47 CDT 2014


Any time I've ever had trouble deleting a directory in a non-Microsoft-created filesystem, it has been for one of two reasons:

1 - The directory serves as a mount-point for a currently-mounted filesystem

2 - I have a terminal open, and the pwd of that terminal is inside of that directory (including instances of screen that are not currently attached, or I have started a screen process inside of that directory and the pwd of that screen terminal is outside of that directory structure, so I have the fact that that dir structure is in use behind my instance of screen).

I don't have much experience with Samba, as I prefer to use sftp/scp whenever possible (which is possible on Windows with the help of cygwin).  It is amazing to use sshmount to mount a Windows filesystem on a Linux filesystem for media sharing or vice versa for doing web development and being able to work with the files on the webserver in a more native-feeling fashion.

I figure you've probably rebooted in between tries to delete this directory, so open screen instances or minimized terminal windows probably isn't your problem.  The only other directory I have ever had a problem deleting was the ".gvfs" directory in my own home directory, which, for some reason, root couldn't even delete (I guess gnome was probably using it at the time -- or is always using it when you have gnome running).  You might, however, check that you don't have any strange mountpoints out there, though.

If the filesystem in which that directory exists is mounted over Samba, then I'm not sure what the rules are at that point (does that dir have something to do with Samba?  It looks a lot like a Windows user directory... is it a backup of a Windows machine?).

-- Matt (N0BOX)

Sent from my ASUS Transformer

-----Original Message-----
From: Ron Houk <houk.ron at gmail.com>
To: Central Iowa Linux Users Group <cialug at cialug.org>
Sent: Fri, 22 Aug 2014 2:52 PM
Subject: Re: [Cialug] Unable to remove a directory in RedHat7

Tom,

To use the find command to try to strip off the directory cd into the
directory above it ( V6 )



and then run

find . -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} \;


I think the way you ran it before with


find Portal -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} \;

it was saying "look inside of directory 'Portal' and delete any
directories inside it."






On Thu, Aug 21, 2014 at 8:08 PM, Paul Gray <gray at cs.uni.edu> wrote:

> On 08/21/2014 07:47 PM, Tom Pohl wrote:
> > Can you try to mv the folder to a higher level like
> /usr/local/samba/public/extended/
> >
> > -Tom
>
> rm -rf can get hung up on unusual filenames, but "find" isn't as finicky.
>
> Just try:
>
>   find /dir -type f -exec rm {} \;
>
> Watch for error messages - they'll expose the culprit.  The above will
> leave all of the directories in place though.
>
> If it goes through, you can also try clipping all directories one-deep:
>
>   find /dir -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} \;
>
>
> --
> Paul Gray                                         -o)
> 314 East Gym, Dept. of Computer Science           /\\
> University of Northern Iowa                      _\_V
>  Message void if penguin violated ...  Don't mess with the penguin
>  No one says, "Hey, I can't read that ASCII attachment ya sent me."
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>
_______________________________________________
Cialug mailing list
Cialug at cialug.org
http://cialug.org/mailman/listinfo/cialug


More information about the Cialug mailing list