Linux : Delete files older than number of days

We first need to list files that are older than number of days (5) find /Data/foldername -name *.mp4 -type f -mtime +5 -exec ls -lh {} \;

If that is what we expect, we’ll run this command to delete:

find /Data/foldername -name *.mp4 -type f -mtime +5 -exec rm -rf {} \;

Leave a Reply

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