Unix find command with mtime
So, how can you find files in Unix older than a specified number of days? The solution is the find command with the option mtime. mtime is the modified time of a file. It's the last time the data in the file was changed. Simple enough.
Find any file in /oback and all of its subdirectories that were last modified 1 day ago:
Find any file in /oback, excluding subdirectories, that were last modified 2 days ago:
Find any file in /oback and all of its subdirectories that were last modified 1 day ago:
find /oback/ -mtime +1
Find any file in /oback, excluding subdirectories, that were last modified 2 days ago:
find /oback/* ! -name . -prune -type f -mtime 2
Comments