Thursday, 28 June 2012

Get list of last modified files

This will output a list of the files, from the current directory and sub-directories that where modified less than a minute ago.
for file in $(find . -mmin -1 -print); do echo "${file} - $(stat -c %y ${file})"; done
if you don't care about the modification time, this will output just the file names:
find . -mmin -1 -print
will suffice.

if you're interested in the files that where modified in the last 24 hours you just have to replace -mmin with -mtime:
find . -mtime -1 -print
And if you don't care about files under sub-folders:
ls -lhtr
might be faster

Possibly Related Posts

No comments:

Post a Comment