Created
April 5, 2019 04:30
-
-
Save markwk/e1d69264a601034d27ec6b7bcd2d421a to your computer and use it in GitHub Desktop.
Mac Screenshot and Images Renamer: Run with the command line or via Alfred to give your images better titles.
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 | |
cd /Users/markkoester/Desktop/ | |
clipboard='' | |
NL=$'\n' | |
for f in Screenshot*.png ; do | |
if [ -f "$f" ] | |
then | |
filedatetime=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' "$f") | |
mv "$f" $filedatetime.png | |
# $(exiftool -d "%Y%m%d%H%M.%S" -CreateDate "$f" | awk '{print $4".png"}')" | |
clipboard="${clipboard}${NL}${filedatetime}.png" | |
fi | |
done | |
for f in Screen*.png ; do | |
if [ -f "$f" ] | |
then | |
filedatetime=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' "$f") | |
mv "$f" $filedatetime.png | |
# $(exiftool -d "%Y%m%d%H%M.%S" -CreateDate "$f" | awk '{print $4".png"}')" | |
clipboard="${clipboard}${NL}${filedatetime}.png" | |
fi | |
done | |
for f in Screenshot*.jpg ; do | |
if [ -f "$f" ] | |
then | |
filedatetime=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' "$f") | |
mv "$f" $filedatetime.png | |
clipboard="${clipboard}${NL}$filedatetime.jpg" | |
fi | |
done | |
for f in IMG_*.jpg ; do | |
if [ -f "$f" ] | |
then | |
filedatetime=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' "$f") | |
mv "$f" $filedatetime.png | |
clipboard="${clipboard}${NL}$filedatetime.png" | |
fi | |
done | |
for f in IMG_*.JPG ; do | |
if [ -f "$f" ] | |
then | |
filedatetime=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' "$f") | |
mv "$f" $filedatetime.png | |
clipboard="${clipboard}${NL}$filedatetime.png" | |
fi | |
done | |
for f in IMG_*.PNG ; do | |
if [ -f "$f" ] | |
then | |
filedatetime=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' "$f") | |
mv "$f" $filedatetime.png | |
clipboard="${clipboard}${NL}$filedatetime.png" | |
fi | |
done | |
echo "$clipboard" | pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment