Re: rmdir when directory is not empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Vian wrote:
On Tue, 2005-12-20 at 15:31 -0500, Gene Heskett wrote:

On Tuesday 20 December 2005 13:20, Chasecreek Systemhouse wrote:

OR rm -fr /dir/dir-delete-me

That won't work on directories that have tens of thousands of files.
--
WC -Sx- Jones | http://ccsh.us/ | Open Source Consulting

Oh? That must mean that all those kernel src dir leftovers I've cleaned over the years are still around then. But I can't find them.

The pony trick is to use, as root, rm -fR name-of-directory


FWIW I have seen several times the failure of a command when using
globbing to create the filelist.  If the list of files is large enough
(in the tens or maybe even hundreds of thousands) the shell hits a limit
where it cannot process the list.

I can confirm it is the globbing because when I encountered this I was
able to move down the directory tree and remove various pieces using the
same command. After *trimming* the tree I was later able to remove the
entire thing. I simply had to do that in pieces instead of all at once.
In my case something had filled the drive (I never found what had
misbehaved so) so there were no remaining free inodes with many
thousands of tiny files.

IIRC it had to do with the number of files at a single level that caused
the globbing to barf.  I also have not had a directory of that size for
more than 4 years so I have not encountered it with more current
software.  This limitation may/may not still be there.

If there are no shell metacharacters on the command line, globbing
cannot be the problem.  For that case globbing never occurs, and
therefore cannot fail.  If that was an extremely deep directory tree,
or one with very long directory names, you might have run into a
PATH_MAX (4096 today, possibly less back then) limitation, and
'cd'-ing part way down the directory tree is indeed the way to work
around that problem.

--
Bob Nichols         Yes, "NOSPAM" is really part of my email address.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux