Created
July 17, 2013 18:07
-
-
Save davemenninger/6022947 to your computer and use it in GitHub Desktop.
Renames files from two directories interleaving them in a merged directory. Intended use with a two-camera diybookscanner.
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
#!/bin/bash | |
IFS="$(echo -e "\n\r")" | |
BASE="page" | |
EXTN="JPG" | |
DEST_DIR="MergedPages" | |
I=0 | |
ls ./EvenPages/*.$EXTN | | |
sort | | |
while read FNAME | |
do | |
#convert -rotate 270 "$FNAME" "$FNAME" | |
DIGITS=$(printf "%04d" $I) | |
mv "$FNAME" "${DEST_DIR}/${BASE}${DIGITS}.${EXTN}" | |
I=$(( I + 2 )) | |
done | |
I=1 | |
ls ./OddPages/*.$EXTN | | |
sort | | |
while read FNAME | |
do | |
#convert -rotate 90 "$FNAME" "$FNAME" | |
DIGITS=$(printf "%04d" $I) | |
mv "$FNAME" "${DEST_DIR}/${BASE}${DIGITS}.${EXTN}" | |
I=$(( I + 2 )) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment