A batch file embedded with PDFInfo.exe and with a PowerShell script that creates a CSV file inventory and calls PDFInfo to supply a page count for all PDF documents in the folder. Also with a -Recursive version that will create an inventory for the folder and all subfolders.
Results are in "00-Inventory-and-Page-Count.csv" in the target directory. (Example assumes all files are in the same directory.)
Attachment | Pages | Combined |
---|---|---|
01 Normal.pdf | 2 | 01 Normal.pdf (2 pages) |
02 Encrypted Password.pdf | 02 Encrypted Password.pdf (Error getting pages) | |
03 Print Password.pdf | 1 | 03 Print Password.pdf (1 page) |
04 Signed.pdf | 1 | 04 Signed.pdf (1 page) |
05 Portfolio.pdf | 1* | 05 Portfolio.pdf (1 page) |
06 Excel.xls | 06 Excel.xls (Error getting pages) | |
07 Image.jpg | 07 Image.jpg (Error getting pages) |
Results are in "00-Inventory-and-Page-Count-Recursive.csv" in the target directory. (Example assumes some files are in sub-directories.)
Attachment | Pages | Combined | RelativePath |
---|---|---|---|
01 Normal.pdf | 2 | 01 Normal.pdf (2 pages) | 01 Normal.pdf |
02 Encrypted Password.pdf | 02 Encrypted Password.pdf (Error getting pages) | 02 Encrypted Password.pdf | |
03 Print Password.pdf | 1 | 03 Print Password.pdf (1 page) | SubFolderA\03 Print Password.pdf |
04 Signed.pdf | 1 | 04 Signed.pdf (1 page) | Subfolder B\04 Signed.pdf |
05 Portfolio.pdf | 1* | 05 Portfolio.pdf (1 page) | Subfolder B\05 Portfolio.pdf |
06 Excel.xls | 06 Excel.xls (Error getting pages) | Subfolder C\06 Excel.xls | |
07 Image.jpg | 07 Image.jpg (Error getting pages) | Subfolder D\07 Image.jpg |
* Note: PDF Portfolios will be listed but the page count will only reflect the first document in the portfolio.
- Download the desired batch file version(s) to your to your target directory.
- Run (double-click) the batch file.
- Read notices/instructions as app runs. Check for errors when completed.
- Cleanup Delete the batch file from your target directory when you no longer need it.
- Open Explorer and navigate to the user's "SendTo" folder by pasting "shell:sendto" into the URL/folder bar. (This should take you to C:\Users[YOUR LOGIN NAME]\AppData\Roaming\Microsoft\Windows\SendTo
- Download the desired batch file version(s) into the SendTo folder.
- Right click on any PDF and select SendTo-> and your desired batch file.
- Read notices/instructions as app runs. Check for errors when completed.
- Review file 00-Inventory-and-Page-Count.csv for the results.
-
Download code and save to a text file. File must end with a blank line.
-
Download PDFINFO.exe from https://www.xpdfreader.com/
-
Put them into the same folder and run the following command line instruction to put the .exe into the end of the batch file
copy /a "00-Inventory and Page Count.txt" + /b pdfinfo.exe /b "00-Inventory and Page Count.bat"
-
Repeat for each version of the batch file.
- Inspiration: https://dmitrysotnikov.wordpress.com/2008/06/27/powershell-script-in-a-bat-file/
- Uses embedded PDFInfo v 4.3 from https://www.xpdfreader.com/ used under terms of GLP 3.
Copyright [2020-2024] Nicholas Grant Cotton
Licensed under the GNU General Public License v3.0