Created
May 12, 2020 20:48
-
-
Save dazzag24/a8974e46ba16b525aca2014de84487e8 to your computer and use it in GitHub Desktop.
Rename files based on creation date of file
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
convert () { | |
local f=$1 | |
echo "Processing ${f}" | |
local filedate=$( stat -c '%y' ${f} | awk -F"." '{print $1}' | awk -F" " '{printf "%s %s", $1, $2}' | sed 's/:/./g' - ) | |
echo "${filedate}-${f}" | |
cp ${f} "../101MEDIA/${filedate}-${f}" | |
} | |
for f in $(ls); do convert $f; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment