Last active
August 29, 2015 14:09
-
-
Save icecreammatt/4011270ed7a9ff6c8d26 to your computer and use it in GitHub Desktop.
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 | |
# Pad a list of images with 0's | |
# %03d means pad with 3 0's, 4.jpg renamed to 004.jpg | |
images=$(ls *.jpg) | |
for image in $images; | |
do | |
echo $image | |
value=$(echo $image | sed 's/.jpg//') | |
padded=$(printf "%03d" $value) | |
echo $padded.jpg | |
mv $image $padded.jpg | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment