Windows/Linux schedule task batch script removing X days old files

From wiki.perl.lt
Jump to: navigation, search

for windows machines, need to add a task in "schedule tasks" for a batch script:

start forfiles -p "C:\what\ever" -s -m *.* -d -<(minus) number of days> -c "cmd /c del @path"

for linux machines, need to add crontab job in /etc/crontab for script:

#!/bin/sh
find /what/ever/folder -mtime +<(plus) number of days> -delete
Personal tools
Categories