Sunday, December 16, 2007

Erase many files in 1 directory in UNIX/Linux

Almost 2 months since my last posting. I have many jobs to do specially non technical made me have no time to continue spread the knowledge to others. Since today I will try to make a posting at least once a week to keep the readers update about this site.

This time I will write about "Erase many files in 1 directory in UNIX/Linux" since I got one case when the logrotate of one of my server using BSD had corrupted and I had no time to fix the logrotate package. So I made a little script and crontab-ed it like once a day in the period of minimum traffic. I use it to clean the quarantince files in qmail. Here the script
(clean-quarantine.sh):

ns1# cd /var/spool/qmailscan/quarantine/new/
ns1# ls | xargs rm

This script helped me to keep the harddrive not full when there is no logrotate process running.





No comments: