Created
October 25, 2020 08:45
-
-
Save nitobuendia/893aaa77a618b28a878d94bb3cfa247a to your computer and use it in GitHub Desktop.
Bash to rename files on current directory based on their modified date
This file contains hidden or 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
for filename in *; do | |
modified_date=$(date -r ${filename} "+snapshot-%Y%m%d") | |
extension="${filename#*.}" | |
mv ${filename} ${modified_date}.${extension} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment