Skip to content

Instantly share code, notes, and snippets.

@indrayam
Last active December 16, 2015 03:49
Show Gist options
  • Save indrayam/5373107 to your computer and use it in GitHub Desktop.
Save indrayam/5373107 to your computer and use it in GitHub Desktop.
Find how long ago file was modified
In OSX:
-------
echo "Token File = $TOKEN_FILE exists ..."
filetime=$(stat -f "%m" -t "%s" $TOKEN_FILE)
currtime=$(date +"%s")
secs_elapsed=$(($currtime-$filetime))
In Linux:
---------
echo "Token File = $TOKEN_FILE exists ..."
filetime=$(stat -c "%Y" $TOKEN_FILE)
currtime=$(date +"%s")
secs_elapsed=$(($currtime-$filetime))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment