Find list of files modified in the last X days

Post Reply
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Find list of files modified in the last X days

Post by a24uall »

Get in to the directory that you want the files to be checked.
cd /home/username/public_html
Below command displays all files recursively that have been modified in the past 6 days.
find . -mtime -6
Arun
WebhostingDevelopment.com
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Re: Find list of files modified in the last X days

Post by a24uall »

How to move files older than X days to a new folder
find /source/folder/path/ -mtime +X -exec mv {} /destination/folder/path/ \;
Example
cd /home/arun/mail/arunp.in/
find cur/ -mtime +365 -exec mv {} /home/arun/mail/arunp.in/arun/.2012/cur/ \;
Arun
WebhostingDevelopment.com
Post Reply

Return to “Miscellaneous”