Last active
December 22, 2015 21:19
-
-
Save rdmarsh/6532254 to your computer and use it in GitHub Desktop.
pad files to 8.3, fill with zeros
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
#!/usr/bin/env bash | |
# Pad a range of file names with extra zeros | |
# AA012345.EXT = AA012345.EXT | |
# BB012345.EXT = BB012345.EXT | |
# ABC.EXT = ABC00000.EXT | |
# ABCDE.EXT = ABCDE0000.EXT | |
for orgfilename in *.EXT ; do | |
#slice of EXT and add zeros | |
newfilename="${orgfilename%%.*}00000000" | |
#slice down to 8 chars and add EXT back on | |
newfilename="${newfilename:0:8}.EXT" | |
mv "${orgfilename}" "${newfilename}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment