I have modified some files present in various folders in my webroot. This was development environment. Now I have to find all files modified yesterday to migrate to productions.
Is there any way (Linux command) to list only those files modified yesterday in my webroot tree?
You can use the find command to find all files that have been modified after a certain number of days. Note that to find files modified before 24 hours ago, you have to use -mtime +1 instead of -mtime -1 .
Finding last day modified files in Linux:The find command is used to search files. The newermt command compares files timestamp with the argument passed, in this case “1 day ago”. Then, the ls command is passed to list the files. To find last day modified files, you can also use the mtime command together with find.
Use -mtime option with the find command to search files based on modification time followed by the number of days. Number of days can be used in two formats.
find ./ -mtime -1
Finds everything, what was modified in the current directory at the last 24 hours.
find . -daystart -mtime 1 -print
This gets just files modified YESTERDAY - ie: today is Jun 21, only files for Jun 20 are found.
(-mtime takes a '-', a '+', or an explicit number of exact days).
If you want a long listing, substitute
-exec ls -ld \;
for the
-print.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With