Skip to content

Instantly share code, notes, and snippets.

@serverhorror
Created December 8, 2011 11:08
Show Gist options
  • Save serverhorror/1446732 to your computer and use it in GitHub Desktop.
Save serverhorror/1446732 to your computer and use it in GitHub Desktop.
Print a date string (rather path segment) with the last mtime of an input path
#!/bin/bash
# Print a date string (rather path segment) with the last mtime of an input path
function format_mtime() {
p = $1
_mtime=$(stat --format="%y" $p)
result=$(date -d "$_mtime" "+%Y/%Y-%m/%Y-%m-%d/%Y-%m-%d_%Hh")
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment