Created
December 17, 2017 21:04
-
-
Save afischer/9788a4126f2a76f46ae692a65bf3e0c0 to your computer and use it in GitHub Desktop.
Bash script to move date-prefixed/count-suffixed photos into folders
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
find -E . -regex '\.\/[0-9]{8}_.*' | while read filename | |
do | |
strippedindex=$(expr "$filename" : "\.\/[0-9]*_[a-zA-Z0-9]*") | |
strippedname=${filename:2:strippedindex-2} | |
mkdir -p "$strippedname" | |
mv "$filename" "$strippedname" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment