[nycbug-talk] Deleting Lots of Files.
mspitzer at gmail.com
Wed Jun 21 15:11:22 EDT 2006
On 6/21/06, Hans Kaspersetz <lamolist at cyberxdesigns.com> wrote:
> I was wondering what the best way to delete lots of files is. Here is
> my problem, I have a mail box directory with 55K files in it. The file
> names are in the form: 1144126802.V411I59451aM517953.foo.com:2, They
> are semi squential.
> I would like to delete all the files in the 114* series. However, when
> I pass rm -f ./114*, I get to many arguments as an error. What I really
> want to delete is all files from before June.
your problem is your shell has issues with long lists of files.
1: try a different shell
2: use a loop:
for i in $(ls |grep ^114) ; do
pipe the grep output through fmt, I prefer par, to cut down on the
number of processes created created if desired(remember to set IFS to
\n to make this work and then set it back)
3: use the ksh $( ) bits to set up an input stream instead of
expanding im place for input
xargs may give you the same line too long error, it has happened to me
on occasion, or it may work fine. I had problems on solaris with it a
you could also write a script.
> Hans K
> % NYC*BUG talk mailing list
> %Be sure to check out our Jobs and NYCBUG-announce lists
> %We meet the first Wednesday of the month
"We trained very hard, but it seemed that every time we were beginning to
form into teams we would be reorganized. I was to learn later in life that
we tend to meet any new situation by reorganizing, and a wonderful method it
can be for creating the illusion of progress, while producing confusion,
inefficiency and demoralization."
-Gaius Petronius, 1st Century AD
More information about the talk