Remove PDF passwords with PowerShell (or CMD)
I think I did it.
Step one: use qpdf
.
As a choco user
choco install qpdf
Secondly, use the following PowerShell one-liner (I couldn't parallelize it because PS gave me an error). Takes a few seconds per file
$password = [THE_PASSWORD]
Get-ChildItem | ForEach-Object { qpdf --decrypt --replace-input --password=$password $_.Name}
I was extremely confident running the script wild into production because I had a strong backup, and I had to restore it a couple of times.
Everyone around has suggested to make a backup before running live.
qpdf
won't do anything if the file is not encrypted.
I will amend the question accordingly, but the script assumes the password is the same for all files