How can I list the files changed in a directory yesterday via the command line?

I would like to list all files with modification dates for the last n days (or even just after Ymd) in a directory. It should work recursively and across all subdirectories.

How can i do this?

Ideal way out:

file.txt    Mar  26 15:15
file2.txt    Mar  27 01:15

      

Valid output:

file.txt
file2.txt

      

Answered! (Thanks for the help)

$ find . -type f -mtime -1 -exec ls -lah {} \;
-rw-r--rw- 1 apache apache 18K Mar 26 08:22 ./file1.txt
-rw-r--rw- 1 apache apache 12K Mar 26 09:23 ./dir1/file2.txt
-rw-r--rw- 1 apache apache 16K Mar 26 10:24 ./dir1/dir2/file3.txt

      

+3


source to share


3 answers


find . -type f -mtime -1 -exec ls -l {} \;



will display all files in the last 24 hours with a long list to confirm the modified date.

+5


source


use:

find . -mtime +1

      



For more information see

man find

      

+1


source


find dir -mtime +1 -print

      

This will find all files in directories and subdirectories that were changed 1 day ago or earlier.

+1


source







All Articles