Created
November 1, 2014 14:53
-
-
Save 2ec0b4/e6a324d32d23c78ae900 to your computer and use it in GitHub Desktop.
Find the 10 last modified files of a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /path/to/dir/ | |
find . -type f -print0 | xargs -0 stat -f "%m %N" | sort -rn | head -10 | cut -f2- -d" " | |
# or with modification time | |
find . -type f -print0 | xargs -0 stat -f "%m %t%Sm %N" | sort -rn | head -10 | cut -f2- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment