List all recently changed files (recursive)

Of course. From the directory you are in do:

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

Add a redirection to it (aka > results.txt to store them into that file).

  • type f does only files and not directories
  • mtime -7 does 7 days ago up to now (+7 would be 'older than 7 days')
  • and it then feeds it to ls to show a long list

You can play with the ls -l part too:

find . -type f -mtime -7 -exec ls -Rl --time-style=long-iso {} \; 
find . -type f -mtime -7 -exec ls -R  --time-style=long-iso {} \; 

will show a tree like method with directories in between the files in long list (1) or short list (2).


With zsh:

ls -l **/*(.m-7)
  • **/* will look for files recursively starting from current directory

  • (.m-7) is glob qualifier where . indicates regular file, m-7 indicates files that were modified within last 7 days


The following command works a dream on Mac OSX - maybe also on ubuntu …

find . -type f -mtime -7 -exec stat -lt "%Y-%m-%d %H:%M:%S" {} \; | cut -d\  -f6- | sort -r

This finds files in the current directory tree which have been modified in the last 7 days, outputs the modification date + time and path, sorted newest first.

Example output:

2018-02-21 22:06:30 ./fmxmlsnippet.xml
2018-02-19 12:56:01 ./diff.html
2018-02-19 12:44:37 ./temp/iDDR/XMSC_fmxmlsnippet.xml
2018-02-18 22:04:05 ./temp/iDDR/XMFD_fmxmlsnippet.xml
2018-02-15 10:18:27 ./xml/iDDR/XML2_fmxmlsnippet.xml
2018-02-15 10:13:29 ./xsl/fmxmlsnippet/XML2_fmCM_AnalyseLayout.xsl
2018-02-15 10:11:36 ./xsl/.DS_Store
2018-02-15 10:10:51 ./xsl/_inc/inc.XML2_fmCM_ReportReferencesToExternalFiles.xsl
2018-02-15 10:10:09 ./xsl/_inc/.DS_Store
2018-02-15 10:07:35 ./xsl/fmxmlsnippet/XML2_fmCM_AnalyseLayout-NoAnchors.xsl
2018-02-15 10:07:35 ./xsl/_inc/inc.XML2_fmCM_AnalyseLayout.xsl

I'd be grateful of any feedback from ubuntu users.


Not exactly what was asked for... but much easier to remember...

ls -alRt docroot

or

ls -alRt /path/to/top/level/directory