Created
September 27, 2014 09:41
-
-
Save pekrockstar/4fdb139b01bfce3afb82 to your computer and use it in GitHub Desktop.
Rename current files
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
#! /usr/bin/env bash | |
arg1=$1 | |
arg2=$2 | |
arg3=$3 | |
FILTER=${arg1:-*} | |
PREFIX=${arg2:-n} | |
SUFFIX=${arg3:-.n} | |
ARR=($(seq -f %03g 10000)) | |
index=0 | |
for name in $FILTER | |
do | |
mv "${name}" "${PREFIX}${ARR[${index}]}${SUFFIX}"; | |
((index++)) | |
done | |
unset ARR | |
unset index |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment