Terminal Scripts - Wiki wiki page

Just a collection of useful scripts

To check a folder and delete all files not accessed in X days

{PATH} = your path to the folder you want to monitor.

{TIME} = time in days since last access


find {PATH} -mindepth 1 -atime +{TIME} -delete

This will find all files and folders within {PATH}, and delete all files and folders not accessed within {TIME} days.

To do a trial run (recommended!) just remove the -delete from the end. If you'd like to keep one more depth of folders change mindepth to 2.

Last Author Contributors Versions Last update
davidc75 adskii 6 Tue, 07 Aug 2018 14:30:27 +0200