Linux Move Files Older Than N Days to Another Directory

February 24, 2021

Move files in /source/photos to /destination/photos/

find /source/photos -maxdepth 1 -mtime +30 -type f -exec mv "{}" /destination/photos/ \;

NOTE: Use -maxdepth 1 to avoid moving files in sub directories

Check files older than N days

find . -maxdepth 1 -mtime +30 -type f -exec ls -l {} \;
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.