Commened out hard links and fixed some bugs
This commit is contained in:
1 parent
628cffcbda
commit
c89f61366c
2 files changed
+44
-22
No files matched your search
@@ -4,8 +4,8 @@
|
|||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
echo -e "What is the directory with the pdfs?"
|
echo -e "What is the directory with the pdfs?"
|
||||||
#read PDFDIR
|
read PDFDIR
|
||||||
PDFDIR="/home/btmccrea/Downloads/pdfs"
|
#PDFDIR="/home/btmccrea/Downloads/pdfs"
|
||||||
if [ -d $PDFDIR ]
|
if [ -d $PDFDIR ]
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
@@ -17,8 +17,8 @@ done
|
|||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
echo -e "What is the output directory for the pdf's with missing addresses?"
|
echo -e "What is the output directory for the pdf's with missing addresses?"
|
||||||
#read OUTPUTFOLDER
|
read OUTPUTFOLDER
|
||||||
OUTPUTFOLDER="/home/btmccrea/Downloads/output"
|
#OUTPUTFOLDER="/home/btmccrea/Downloads/output"
|
||||||
if [ -d $OUTPUTFOLDER ]
|
if [ -d $OUTPUTFOLDER ]
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
@@ -49,9 +49,9 @@ do
|
|||||||
pdftotext "$f" - > TEMP
|
pdftotext "$f" - > TEMP
|
||||||
#cat TEMP
|
#cat TEMP
|
||||||
#assigns the lines with relevant values to their variable
|
#assigns the lines with relevant values to their variable
|
||||||
USER=$(sed -n '10p' TEMP)
|
USER=$(sed -n '12p' TEMP)
|
||||||
ADDRESS1=$(sed -n '11p' TEMP)
|
ADDRESS1=$(sed -n '13p' TEMP)
|
||||||
ADDRESS2=$(sed -n '12p' TEMP)
|
ADDRESS2=$(sed -n '14p' TEMP)
|
||||||
echo -e "User is $USER"
|
echo -e "User is $USER"
|
||||||
echo -e "Address is $ADDRESS1 $ADDRESS2"
|
echo -e "Address is $ADDRESS1 $ADDRESS2"
|
||||||
if [ -z "$ADDRESS1" ]
|
if [ -z "$ADDRESS1" ]
|
||||||
|
|||||||
Regular → Executable
+37
-15
@@ -3,28 +3,50 @@
|
|||||||
#get directory for pdf files
|
#get directory for pdf files
|
||||||
#get output directory for files
|
#get output directory for files
|
||||||
|
|
||||||
#Get the location of the PDF files
|
|
||||||
echo "What is the location of the PDF files"
|
#Get the folder with the pdf documents in it.
|
||||||
#read FILE
|
while :
|
||||||
FILE=/home/btmccrea/Downloads/output/Only_Good/*
|
do
|
||||||
#cd $FILE
|
echo -e "What is the directory with the pdfs?"
|
||||||
for FILENAME in $FILE
|
read PDFDIR
|
||||||
|
#PDFDIR="/home/btmccrea/Downloads/pdfs"
|
||||||
|
if [ -d $PDFDIR ]
|
||||||
|
then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo -e "Directory not found."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
#Get the folder for the output file.
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
echo -e "What is the output directory for the pdf's with missing addresses?"
|
||||||
|
read OUTPUTFOLDER
|
||||||
|
#OUTPUTFOLDER="/home/btmccrea/Downloads/output"
|
||||||
|
if [ -d $OUTPUTFOLDER ]
|
||||||
|
then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo -e "Directory not found."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cd $PDFDIR
|
||||||
|
for FILENAME in $PDFDIR/*
|
||||||
do
|
do
|
||||||
echo $FILENAME
|
echo $FILENAME
|
||||||
#The next Line assigns the number of pages to the value LOCATION to be used for were the file goes
|
#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.
|
#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 /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf
|
if test -f $OUTPUTFOLDERStatement-Pages-$LOCATION.pdf
|
||||||
then
|
then
|
||||||
mv /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf /home/btmccrea/Downloads/output/Final/temp.pdf
|
mv $OUTPUTFOLDERStatement-Pages-$LOCATION.pdf $OUTPUTFOLDERtemp.pdf
|
||||||
pdfunite "$FILENAME" /home/btmccrea/Downloads/output/Final/temp.pdf /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf
|
pdfunite "$FILENAME" $OUTPUTFOLDERtemp.pdf $OUTPUTFOLDERStatement-Pages-$LOCATION.pdf
|
||||||
else
|
else
|
||||||
#IF the file doesn't exist create the file with the merge.
|
#IF the file doesn't exist create the file with the merge.
|
||||||
pdfunite "$FILENAME" /home/btmccrea/Downloads/output/Final/Statement-Pages-$LOCATION.pdf
|
pdfunite "$FILENAME" $OUTPUTFOLDERStatement-Pages-$LOCATION.pdf
|
||||||
fi
|
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 /home/btmccrea/Downloads/output/Final/Statement-* $FILE/Finished/
|
|
||||||
done
|
done
|
||||||
exit
|
exit
|
||||||
Reference in new issue
Block a user