Skip to content

Instantly share code, notes, and snippets.

@anthonynsimon
Created March 8, 2017 16:15
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 anthonynsimon/f8719aed7633f63ff3fb039ee23be133 to your computer and use it in GitHub Desktop.
Save anthonynsimon/f8719aed7633f63ff3fb039ee23be133 to your computer and use it in GitHub Desktop.
Bash script preprend timestamp to filename
#!/bin/bash
for f in *; do mv -- "$f" "$(stat -f "%Sm_%N" -t "%Y%m%d" "$f")"; done
@anthonynsimon
Copy link
Author

Example input: DSC00001.JPG, output: 20170303_DSC00001.JPG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment