Created
May 8, 2014 17:40
-
-
Save wesleybliss/cb0bffb552d1e3a3529b to your computer and use it in GitHub Desktop.
Show the last N modified files, recursively.
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 | |
count=10 | |
filter='*.*' | |
if [ ! -z "$1" ]; then | |
if [ "$1" == "--help" ]; then | |
echo "USAGE $0 [count] [filter (e.g. *.java)]" | |
exit 0 | |
fi | |
count="$1" | |
fi | |
if [ ! -z "$2" ]; then | |
filter="$2" | |
fi | |
find . -type f -name "$filter" -printf '%T@ %p\n' | sort -n | tail -$count | cut -f2- -d" " | |
echo "" | |
echo "Showing last $count modified files" | |
echo " -> matching \"$filter\"" | |
echo " -> in order of oldest to newest..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment