Remove files older than X

R

Rob

Guest
We have video cameras saving footage on to a fileserver - but it's taking up about 30G/day.. so I wanted to do something to remove files older than a week or so.. All it took was throwing this command into a cron job:


Code:
/usr/bin/find /mnt/data/cam/201?/ -type f -mtime +8 -exec rm -f {} \;

This will find files under the /mnt/data/cam/2011/ (or 2012, 2013, etc..) directory that are 8 days old and remove them. You can test the command by replacing "rm -f" with "ls" to see what files it found..
 


G

Gerad

Guest
If you just want to find a list of files that is older than 90 days. I find that this command works pretty well.

Code:
find . -name "*" -mtime -90 -print
 

Members online

No members online now.

Latest posts

Top