search
top

Remove files that are older than x days

First you want to see which files will be deleted. This examples looks for files older than 7 days.

find /directory/to/search/through/ -type f -mtime +7 -print | xargs echo

If you’re satisfied with the list, you can actually delete them:

find /directory/to/search/through/ -type f -mtime +7 -print |  xargs rm -f
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

top