Tuesday, May 17, 2011

Command to delete files from a UNIX box.

find . -mtime +7 -exec rm{} ';'

The above command deletes files created before a week from the present day from the current directory.
I can put this command in a shell script and run it in chrontab to remove the log files on a daily basis.

No comments: