Created
August 29, 2021 20:50
-
-
Save PaulGoldschmidt/2c35025ca7d27cb1fb11662b1d19fca1 to your computer and use it in GitHub Desktop.
Rename Files in Linux by adding leading current 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
#!/bin/bash | |
today=`date '+%Y-%m-%d_'`; | |
basedir=/some/path/ | |
for filename in $basedir*.jpg; do | |
cutfilename=$(basename $filename) | |
new_filename=$basedir$today$cutfilename | |
mv -v $filename $new_filename | |
done | |
echo "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment