2007 May 08 - Tue
Removing lots of files
If I don't have a clean up program running, sometimes autocollected files tend to
accumulated. For example, netflow processing on 5 minute intervals can accumulate a large
number of files. An 'rm' with a partical wild card seems to complain.
I've resorted to a chaining some command line utilities to come up with a quick script to
remove files:
ls -1 | grep ft-v05.2007-0[123] | sed 's/^/rm /' > t.sh
This generates a one column directory listing and puts it through grep. Grep looks for a
few specific months of files and passes the list onto sed. Sed preappends the removal
command onto each file name. The whole shooting match is thrown into a shell script.
Either set execute privileges on the script:
chmod 500 t.sh
Or run with with the shell command:
bash t.sh
|