Fixed problems with 2020 file and logic improvments

This commit is contained in:
btmccrea committed 2021-01-24 08:36:11 -05:00
1 parent 2fb552ed8a
commit 628cffcbda
3 files changed
+116 -43

No files matched your search

+13 -10
View File
@@ -5,23 +5,26 @@
#Get the location of the PDF files
echo "What is the location of the PDF files"
read FILE
#read FILE
FILE=/home/btmccrea/Downloads/output/Only_Good/*
#cd $FILE
for FILENAME in $FILE
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}')
#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 /mnt/tmpfs/Statement-Pages-$LOCATION.pdf; then
mv /mnt/tmpfs/Statement-Pages-$LOCATION.pdf /mnt/tmpfs/temp.pdf
if test -f /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf
then
mv /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf /home/btmccrea/Downloads/output/Final/temp.pdf
pdfunite "$FILENAME" /home/btmccrea/Downloads/output/Final/temp.pdf /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf
else
pdfunite "$FILENAME" /mnt/tmpfs/temp.pdf /mnt/tmpfs/Statement-Pages-$LOCATION.pdf
#IF the file doesn't exist create the file with the merge.
pdfunite "$FILENAME" /mnt/tmpfs/Statement-Pages-$LOCATION.pdf
fi;
#IF the file doesn't exist create the file with the merge.
pdfunite "$FILENAME" /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf
fi
#once everything else is doen Make the directory to place the files into
#and copy the finished files into it.
mkdir $FILE/Finished/
cp -r /mnt/tmpfs/Statement-* $FILE/Finished/
#mkdir $FILE/Finished/
#cp -r /home/btmccrea/Downloads/output/Final/Statement-* $FILE/Finished/
done
exit