Update file Run.sh
This commit is contained in:
1 parent
ae55276298
commit
03b5b5d7df
1 file changed
+16
-17
@@ -64,27 +64,26 @@ do
|
||||
echo "Copying file to the folder called Addresses"
|
||||
fi
|
||||
done
|
||||
echo "All done sorting!" You can find all the Files in $OUTPUTFOLDER!"
|
||||
echo "All done sorting! You can find all the Files in $OUTPUTFOLDER!"
|
||||
echo
|
||||
# echo
|
||||
# read -r -p "Do you want to continue? [Y/n]" response
|
||||
# response=${response,,} # tolower
|
||||
# if [[ $response =~ ^(y| ) ]] || [[ -z $response ]]; then
|
||||
|
||||
cd $PDFDIR
|
||||
for FILENAME in $PDFDIR/*
|
||||
do
|
||||
echo $FILENAME
|
||||
echo
|
||||
read -r -p "Do you want to continue? [Y/n]" response
|
||||
response=${response,,} # tolower
|
||||
if [[ $response =~ ^(y| ) ]] || [[ -z $response ]]; then
|
||||
cd $PDFDIR
|
||||
for FILENAME in $PDFDIR/*
|
||||
do
|
||||
echo $FILENAME
|
||||
#The next Line assigns the number of pages to the value LOCATION to be used for were the file goes
|
||||
LOCATION=$(pdfinfo "$FILENAME" | grep Pages: | awk '{print $2}')
|
||||
LOCATION=$(pdfinfo "$FILENAME" | grep Pages: | awk '{print $2}')
|
||||
#Test if the file exists and if it does move it to Temp.pdf to be merged back to its original location.
|
||||
if test -f $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
|
||||
then
|
||||
mv $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf $OUTPUTFOLDER/temp.pdf
|
||||
pdfunite "$FILENAME" $OUTPUTFOLDER/temp.pdf $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
|
||||
else
|
||||
if test -f $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
|
||||
then
|
||||
mv $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf $OUTPUTFOLDER/temp.pdf
|
||||
pdfunite "$FILENAME" $OUTPUTFOLDER/temp.pdf $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
|
||||
else
|
||||
#IF the file doesn't exist create the file with the merge.
|
||||
pdfunite "$FILENAME" $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
|
||||
pdfunite "$FILENAME" $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
Reference in new issue
Block a user