Last active
September 25, 2020 16:16
-
-
Save jghorton14/1511e0ebeb792393557f017b9bcbc225 to your computer and use it in GitHub Desktop.
Im terrible at bash... But a bash script that organizes your files by a date format to be easily sorted
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
#!/bin/bash | |
# Install exiftool to grab metadata from picture | |
sudo apt-get install libimage-exiftool-perl | |
# Create Directory to format | |
mkdir Formatted | |
# jpg | |
for f in *.jpg | |
do | |
DATE=$(exiftool -T -createdate -d "%Y-%m-%d(%I:%M%p)" $f) | |
cp $f Formatted/ | |
cd Formatted/ | |
mv $f $DATE.jpg | |
cd .. | |
done | |
# JGP | |
for f in *.JPG | |
do | |
DATE=$(exiftool -T -createdate -d "%Y-%m-%d(%I:%M%p)" $f) | |
cp $f Formatted/ | |
cd Formatted/ | |
mv $f $DATE.JPG | |
cd .. | |
done | |
# png | |
for f in *.png | |
do | |
DATE=$(exiftool -T -createdate -d "%Y-%m-%d(%I:%M%p)" $f) | |
cp $f Formatted/ | |
cd Formatted/ | |
mv $f $DATE.png | |
cd .. | |
done | |
# PNG | |
for f in *.PNG | |
do | |
DATE=$(exiftool -T -createdate -d "%Y-%m-%d(%I:%M%p)" $f) | |
cp $f Formatted/ | |
cd Formatted/ | |
mv $f $DATE.PNG | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment