Find files modified in the last n days, or today | useful with folders
Follow @ggarronIntroduction
If you wan to find files or directories, that were last modified in the last n days or just today, it is really easy to do in Linux.
How to find files last modifies today
Use the find command to do this
find -maxdepth 1 -type f -mtime 1
- maxdepth: will tell
findto only search in the current folder - type: will tell
findto only list files and not directories - mtime: will tell
findto only list the files modified in the last 24 hours
So, you can modify this command to accomplish another tasks.
Find files modified in the last 48 hours, and in current folder and one level below
find -maxdepth 2 -type f -mtime 2
Same thing with folders
find -maxdepth 2 -type d -mtime 2