Counting Pages in PDF files
Symptoms
When planning a task it can be usefult to know how many total pages you'll find in a collection of PDF files.
Cause
n/a
Resolution
The pdfinfo tools is a useful CLI utility to use with Windows/Powershell. Windows and Linux versions can be downloaded from: [https://www.xpdfreader.com/download.html](https://www.xpdfreader.com/download.html)
Example use: $folder = 'C:\Test' $Total = $Files = 0
foreach($File in (Get-ChildItem -Path $Folder -Filter *.pdf)){ $Pages = (pdfinfo $File.FullName | Select-String -Pattern '(? And output: PdfFile Pages
2014-02-25_Allwinner A80.pdf 1 test.pdf 4
TotalNumber of pages: 5 in 2 files
Source: [https://superuser.com/questions/1446208/counting-total-number-of-pages-across-multiple-pdf-files-on-the-windows-powersh](https://superuser.com/questions/1446208/counting-total-number-of-pages-across-multiple-pdf-files-on-the-windows-powersh)[](https://superuser.com/questions/1446208/counting-total-number-of-pages-across-multiple-pdf-files-on-the-windows-powersh)[](https://superuser.com/questions/1446208/counting-total-number-of-pages-across-multiple-pdf-files-on-the-windows-powersh)