RE: Deleting LARGE number of files

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

 



Quoting Ryan Golhar <golharam@xxxxxxxxx>:
> Just out of curiousity, why is it a problem to delete a large
> number of files?  What is 'rm' doing?  This sort of sounds like
> a bug in rm.

Not a bug in rm, but more likely, Chris is hitting up against
a shell limit in the number of args that "*" expands to.

Try doing the following in the same directory:

  $ echo *

This will probably get you a similar error, since what the shell
does is to expand the "*" to a list of all matching items in
that current directory, and it does so in the command line of
the shell (invisibly).  Even the shell has its buffer limits.

A better approach would be to recursively delete the directory
from the directory above it, as someone has already described.
If you want to delete the directory 'b' and all of the files
contained in it, and directory 'b' lives under directory 'a'
(e.g. /a/b), then 'cd /a' and 'rm -r b'.  That should do it.

K



> --- Chris <redhat-list@xxxxxxxxxxxxxxxxxxx> wrote:
> > Okay, newbie question - and I can't find the answer
> > on Google...  :-|
> > 
> > How can you delete the contents of a directory that
> > has a HUGE number of files?  By huge I mean when
> > "rm -f *" complains with "too many items" error
> > message.  I don't care what's in there, I just want
> > to wipe it all.


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux