Skip to content

Instantly share code, notes, and snippets.

@rockstar2046
Created September 27, 2014 09:41
Show Gist options
  • Save rockstar2046/4fdb139b01bfce3afb82 to your computer and use it in GitHub Desktop.
Save rockstar2046/4fdb139b01bfce3afb82 to your computer and use it in GitHub Desktop.
Rename current files
#! /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