Created
November 22, 2016 20:14
-
-
Save ivanrosolen/1e11d899c158472a5fb9b5ff90e84305 to your computer and use it in GitHub Desktop.
Rename file using regex
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 | |
for filename in *.jpg; do | |
newFilename=$(echo $filename | \ | |
sed -E 's#^.+_(.+).jpg$#\1.jpg#') | |
mv "$filename" new/"$newFilename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment