Skip to content

Instantly share code, notes, and snippets.

@earthiverse
Created October 10, 2018 04:59
Show Gist options
  • Save earthiverse/0d95b2f642e59dd87f1ef2f27eb827ca to your computer and use it in GitHub Desktop.
Save earthiverse/0d95b2f642e59dd87f1ef2f27eb827ca to your computer and use it in GitHub Desktop.
Decrypting all files in a folder with qpdf and powershell
#TODO #1: Change the path to the folder you want to convert all the files
Get-ChildItem "C:\Users\Path\To\Folder\Full\Of\PDFs" -Filter *.pdf |
Foreach-Object {
Write-Host "Decrypting $($_.FullName)..."
# TODO #2: Change the path to your qpdf.exe executable.
C:\Path\to\qpdf\bin\qpdf.exe --decrypt $_.FullName "$($_.FullName).decrypted"
Remove-Item $_.FullName
Rename-Item "$($_.FullName).decrypted" -NewName $_.Name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment