erase file by batches

65 views Asked by At

Need to erase 150K files from a folder, and I want to erase them by batches

what would be the best way ?

for instance delete the first 1000 results of

find . -time +600 -exec rm {} \;
1

There are 1 answers

0
Uwe Innh On

Your command assumes that there are no subdirs, so that's what I'll assume. This is in a bash

find . -print > /tmp/gaga

for i in `head -n 1000 /tmp/gaga`
do
rm -f $i
done

Then repeat until no more files.