Hi all,
I am wondering if anyone has any prebuilt batch scripts or the like to find in a recursive file search:
all password-protected encrypted rar/zip/7z archives
all password-protected encrypted PDF files
Probably some tricks to roll my own using 7-zips 7z.exe or WinRAR's rar.exe (does not handle 7z/zip files though only RAR files) but it seems challenging as information itself is not display but prompts and such depending if the filenames are encrypted or not (with 7z not zip), etc. As for PDFs I would suspect a special PDF information utility is needed to determine the security setting. Is there any easy option to do this? If I merely had a command line tool which gave the information in an easy to decipher format, rolling a batch script would be simply to do it recursively from any directory.
The only thing I have found is that for zip/7z files the following will work:
Quote:
7z t -p_ archive.7z >nul 2>nul
if errorlevel 1 echo Password exists
|
For rar/rar4 files the following is the best I could come up with:
Quote:
unrar vt -p_ archive.rar | find "Flags: encrypted" >nul 2>nul
if not errorlevel 1 echo Password exists
|
Ultimately I want to remove passwords as often years after I download something I cannot figure out what something is or its password. Adobe Acrobat can remove passwords from PDFs and WinRAR can extract and recompress without passwords so the solution to remove passwords is at least reasonably straight forward. Of course the filename could just append -password-... to the filename as an alternative. But its important to do this I have found.