Friday 13 October 2017

Find and Delete All Files Older than 10 Days using mtime | Linux

#to file files older than 10 days:
find /home/folder/ -mtime +10;

#now append it with -exec switch +  rm {} loop to delete all found files:
find /home/folder/ -mtime +10 -exec rm {} \;

----------------------
#and to find only in specific directory ignore sub directories

find /home/folder/ -maxdepth 1 -mtime +10

No comments:

Post a Comment