-
-
Save adam000/6099794 to your computer and use it in GitHub Desktop.
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 | |
function move_sequential { | |
if [[ $# != 4 ]]; then | |
echo Usage: move_sequential <prefix> <first number to move, inclusive> <last number to move, inclusive> <suffix> | |
return 1 | |
fi | |
PREFIX=$1 | |
FIRST=$2 | |
LAST=$3 | |
SUFFIX=$4 | |
DIR="mv_$FIRST_$LAST" | |
mkdir $DIR | |
if [[ $? != 0 ]]; then | |
echo "Folder $DIR already exists :/" | |
return 2 | |
fi | |
$IDX=1 | |
for i in {$FIRST..$LAST}; do | |
NUM=`printf '%04d' $i` | |
NEWNUM=`printf '%04d' $IDX` | |
echo mv DSC_$NUM.JPG $DIR/DSC_$NEWNUM.JPG | |
$IDX=$(($IDX+1)) | |
done | |
} | |
#untested, also an 'echo' instead of an actual mv for testing purposes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment