Created
July 7, 2011 20:22
-
-
Save marians/1070457 to your computer and use it in GitHub Desktop.
Batch renaming files to create a numbered file sequence
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 | |
# Assuming that you have a number of | |
# PNGs in a folder pngs/, this script | |
# will rename them to a file sequence | |
# like 0001.png, 0002.png, ... | |
n=0 | |
for f in pngs/*.png; do | |
n=`expr $n + 1`; | |
name=`printf "%04d" $n`.png; | |
mv $f pngs/$name | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment