Last active
October 8, 2018 15:09
-
-
Save kampfgnu/998a9d35af711e6c0f68c1a1a4cd55cd to your computer and use it in GitHub Desktop.
rename files to their creation date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd $1 | |
for file in *.{JPG,jpg} | |
do date=$(stat -f %B $file) | |
dateFormatted=$(date -r $date +%Y-%m-%d' '%H.%M.%S) | |
mv $file "$dateFormatted.jpg" | |
done | |
for file in *.{MOV,mov} | |
do date=$(stat -f %B $file) | |
dateFormatted=$(date -r $date +%Y-%m-%d' '%H.%M.%S) | |
mv $file "$dateFormatted.mov" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment