If you use Harvest and need to export your invoices every time you need to file your taxes, you know the time it takes to select only the invoices you need.
To speed things up a little i looked at some cli scripts to help me.
First you need to install xquartx and pdfgrep. I install these packages with brew.
If these packages are installed go to the folder where all your invoices al stored.
- Move all invoices made from 01-03 into the folder 2015-Q1, make sure you created the folder first.
- Now we will change the default harvest name into $invoice-number.pdf
- Merge all pdfs’s
mkdir 2015-Q1
for i in `pdfgrep -H "Factuurdatum[ ]*[0-9]{2}/(01|02|03)/2015" *.pdf | cut -d: -f1`; do mv $i 2015-Q1/; done
IFS=":"
pdfgrep -H "Factuurnummer" *.pdf | sed -E "s/Factuurnummer[ ]{0,}//g" | while read pdf id ; do mv $pdf $id.pdf; done
pdfunite 2015-*.pdf Q1.pdf