I want a shell script to delete files in a backup directory.

The files in the directory are named according to dates. For example raw_backup071208:061727 (%y%m%d:%H%M%S). I want to compare the dates and make sure that the file is one week old before i delete it.



Hey There,

You should be able to do this just by using "find"'s -mtime option

find /directory/ -mtime +7 -exec rm {} \;

That will check all the files in /directory/

Hope that helps :)

, Mike