Combining PDFs with PDFTK Into a Folder by Year and Month
2018-11-25 16:15:06 +0000 - Written by Carl Burks
First downloading the Language Specification from Microsoft will give you a good start into how to use PowerShell. https://www.microsoft.com/en-us/download/details.aspx?id=36389
In PowerShell a comment begins with the octothorpe #
# This is a comment it doesn't actually do anything it just lets you write notes.
In the language specification you can read about comments in the section 2.2.3.
You might read section 13.19 in the Language Specification to learn about how to get help, or run in PowerShell
Control of Flow
Control of Flow is how your program runs. Wikipedia does a pretty good job of explaining it.
Here is a PowerShell Specific explanation:
To learn about loops read here: https://blogs.technet.microsoft.com/heyscriptingguy/2014/04/28/basics-of-powershell-looping-foreach/
Sometimes you want to use “My Documents” from PowerShell.
Here is how to use that:
O’Reily has a book called PDF Hacks and they have a website for the book.
One of the tools described is PDFTK.
This is a great tool to learn for manipulating PDFs.
PDFLabs has the manpages for using the tool here.
Here is the download page:
When you install it, don’t uncheck the add to path button. We will need it in the path for the example script.
Putting them together
Here is a script: https://burksbrand.com/static/powershell_pdftk_month_folder_example.ps1
The script will give you a warning telling you to only run scripts you trust. Running a script from the internet can be dangerous. It is important to read and understand what the script is doing before attempting to run it.
The script has been commented for ease of use of someone not familiar with PowerShell.