I have correctly written the following PowerShell command to traverse every folder and subfolder of a directory and display the contents of each such folders:
Get-ChildItem -Path "C:whiskeyTangoCharlie" –Recurse
I have also written a PowerShell script that correctly works and can extract text from each pdf file in a single folder.
cd "C:whiskey"
$FILES= ls *.pdf
foreach ($f in $FILES) {
& "C:Program Filesxpdf-tools-win-4.02bin32pdftotext.exe" -enc UTF-8 "$f"
}
I am trying to combine both scripts in order to traverse all folders and subfolders and execute the pdftotext program. And so I wrote:
$files=Get-ChildItem -Path "C:whiskeyTangoCharlie" –Recurse
foreach ($f in $files){
& "C:Program Filesxpdf-tools-win-4.02bin32pdftotext.exe" -enc UTF-8 "$f"
}
; which is incorrect. I receive the following error: pdftotext.exe : I/O Error: Couldn’t open file. Note none of the pdf files are protected.
Question: How do I correct this error?