Feb 15, 2002 #1 pixelboi Technical User Feb 15, 2002 2 US I need to write a cron job to run hourly that checks all files in a directory and deletes files that are older than 30 days. id like it to also delete *.exe *.vbs *.bat type files as soon as it see them, any ideas? any help would be great, thanks!
I need to write a cron job to run hourly that checks all files in a directory and deletes files that are older than 30 days. id like it to also delete *.exe *.vbs *.bat type files as soon as it see them, any ideas? any help would be great, thanks!
Feb 15, 2002 #2 Guest_imported New member Jan 1, 1970 0 here is a ksh script I use. the last entry just deletes .log file the other directories are all file extentions hth #!/usr/bin/ksh . ~/.profile # # This scripts is used to clean out any files over 7,14,30 and 60 days old in the tmp directory # find $HOME/tmp -name '*' -mtime +7 -exec \rm -f {} \; 1> /dev/null 2>&1 find $HOME/out -name '*' -mtime +14 -exec \rm -f {} \; 1> /dev/null 2>&1 find $HOME/data -name '*.*' -mtime +60 -exec \rm -f {} \; 1> /dev/null 2>&1 find $app -name '*.log' -mtime +14 -exec \rm -f {} \; 1> /dev/null 2>&1 exit ~ Upvote 0 Downvote
here is a ksh script I use. the last entry just deletes .log file the other directories are all file extentions hth #!/usr/bin/ksh . ~/.profile # # This scripts is used to clean out any files over 7,14,30 and 60 days old in the tmp directory # find $HOME/tmp -name '*' -mtime +7 -exec \rm -f {} \; 1> /dev/null 2>&1 find $HOME/out -name '*' -mtime +14 -exec \rm -f {} \; 1> /dev/null 2>&1 find $HOME/data -name '*.*' -mtime +60 -exec \rm -f {} \; 1> /dev/null 2>&1 find $app -name '*.log' -mtime +14 -exec \rm -f {} \; 1> /dev/null 2>&1 exit ~
Feb 15, 2002 #3 Guest_imported New member Jan 1, 1970 0 pay no attention to the bad comment in that script... the tmp dir is cleaned out files 7 days old out directory 14 days old data directory 60 days old and app dir .log files 14 days old Upvote 0 Downvote
pay no attention to the bad comment in that script... the tmp dir is cleaned out files 7 days old out directory 14 days old data directory 60 days old and app dir .log files 14 days old
Feb 15, 2002 Thread starter #4 pixelboi Technical User Feb 15, 2002 2 US that will work! thanks! Upvote 0 Downvote