Linux Find and Remove/Delete Files Older Than N Days

February 22, 2021

Remove files in current directory older than 7 days

find . -type f -mtime +7 -execdir rm -- '{}' \;

List files only

find . -type f -mtime +7 -exec ls -l {} \;

NOTE: Use -maxdepth 1 to ignore sub directories.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.