Monday, May 02, 2005

How many files can one directory take...

And so the saga continues. More and more problems are being unearthed.
This time it's that my php session garbage collector hasn't been collecting garbage. There is at least 500 000 files in my php session directory... which is about 500 000 too many. Deleting it is fun, because rm * doesn't really work - it's got too many files...
That's where we become friends with a little program called xargs. This takes a bunch of consecutive command line printouts and combines them into the arguments of a program. or something like that.
Using it and the find program, you can make a very pretty little... well... one line program that finds all the files in a directory and removes them, 1000 files at a time.
And that's what we've been doing for about 20 minutes. Keep in mind we probably remove 1000 files a second. So that's probably about 1.2 million, or a few more. It would have been interesting to know how many went, but I really really have no way of knowing. Any script that would count them would just be to complicated, memory hungry and inaccurate now anyway :-)
Very sleepy ... but not hungry.

1 Comments:

Anonymous Anonymous said...

I was wondering how you were getting on. Hope your script confined itself to the right directory!!! Been there, done that!

8:11 am  

Post a Comment

<< Home

Google