Skip to content

Instantly share code, notes, and snippets.

@ChatchaiJ
Created July 14, 2016 17:15
Show Gist options
  • Save ChatchaiJ/6d0663700924c4795de495568e2f8f7e to your computer and use it in GitHub Desktop.
Save ChatchaiJ/6d0663700924c4795de495568e2f8f7e to your computer and use it in GitHub Desktop.
#!/bin/bash
LOCATION="$1"
[ -z "$LOCATION" ] && { echo "Usage: $0 LOCATION"; exit; }
FILE=$(
find $LOCATION -type f -exec ls --full-time {} \; |\
cut -f6- -d' ' |\
sort -r |\
head -1 |\
cut -f4- -d' '
)
STAMP=$(date -r "$FILE" "+%Y-%m-%d %H:%M:%S")
echo "$STAMP $FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment