How to search for files modified within a specific time range with the 'find' command in Linux?
Published on Aug. 22, 2023, 12:17 p.m.
To search for files modified within a specific time range with the ‘find’ command in Linux, you can use the ‘-newerXY’ option followed by a reference file or date.
For example, to find all files modified within the last 7 days, you can use the following command:
find /path/to/directory -type f -newermt "7 days ago"
This will find all files in the specified directory and its subdirectories that were modified within the last 7 days.
You can also specify a specific date and time instead of using “X days ago”. For example:
find /path/to/directory -type f -newermt "2022-09-20 00:00:00" -not -newermt "2022-09-22 00:00:00"
This will find all files that were modified between September 20th, 2022 and September 22nd, 2022.