Deleting LARGE number of files

Trevor trevor at gnuguy.com
Tue Apr 27 17:09:20 UTC 2004


It is also possible to rename the old directory, create a new one, set
permissions on it and then delete the old directory "rm -rf somedirname".

It's not the best approach, but it does work.


-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com]On Behalf Of Sites, Brad
Sent: Tuesday, April 27, 2004 10:46 AM
To: 'golharam at umdnj.edu'; 'General Red Hat Linux discussion list';
'Chris'
Subject: RE: Deleting LARGE number of files


On Tuesday, April 27, 2004 10:12 AM, Ryan Golhar is quoted as saying:

> I encountered the same issue and had to delete groups of files,
> something like rm a*, then rm b*.
>
>
> Ryan
>
>
> 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.
>
> Thanks,
>
> Chris
>


The other option is a find command as such:

#find /directory/path -name * -exec rm -f {} \;

You shouldn't have any problem with the number of files using this method.

Brad Sites, RHCE


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





More information about the redhat-list mailing list