Last active
December 10, 2015 15:19
-
-
Save mhammonds/4453654 to your computer and use it in GitHub Desktop.
Quick script for prefixing images with Bash.
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 | |
if [ ! -z "$1" ] | |
then | |
PREFIX=$1 | |
else | |
echo "Enter the filename prefix:" | |
read PREFIX | |
fi | |
shopt -s nullglob | |
for FILE in *.png *.jpg *.jpeg *.gif | |
do | |
echo "Renaming $FILE to $PREFIX$FILE. . ." | |
mv "$FILE" "$PREFIX$FILE" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment