Skip to content

Instantly share code, notes, and snippets.

@wesleybliss
Created May 8, 2014 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesleybliss/cb0bffb552d1e3a3529b to your computer and use it in GitHub Desktop.
Save wesleybliss/cb0bffb552d1e3a3529b to your computer and use it in GitHub Desktop.
Show the last N modified files, recursively.
#!/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