3 February 20252025-02-03T00:00:00.000ZList the most recently modified files across a folder and all its subfolders with a single macOS Terminal command using find, stat, sort and head.how-to
Display most recently modified files in a folder, and all subfolders, using Terminal
List the most recently modified files across a folder and all its subfolders with a single macOS Terminal command using find, stat, sort and head.
I recently needed to search through a fairly extensive list of files to find when the most recently modified files were last edited, and needed to search in a folder and all subfolders.
This one-liner did the trick for me – change the head -20 at the end to a different number to see that number of most recently modified files.
find . -type f -exec stat -f "%Sm %N" -t "%Y-%m-%d %H:%M:%S" {} + | sort -r | head -20
Related Services
Need support with this in your environment?
These services cover the same kinds of issues discussed in this article.
Comments