Office Software Thread, Walk a directory tree, check if docs are password protected, log ones that are? in Technical; I need to walk a series of directory trees, look at each file and log whether it's password-protected or not. ...
31st March 2010, 01:47 PM #1
Walk a directory tree, check if docs are password protected, log ones that are?
I need to walk a series of directory trees, look at each file and log whether it's password-protected or not. For the .doc format, I can just point the unix "file" command at the trees and grep on "Security: 1", but that doesn't work for .docx, which just shows up as an archive.
I've found some vb that works by logging an error on bad passwords, but it's a horrible kludge and not reliable. I've also found lots of shady freeware/payware.
Anyone found (or paid for) something that works well?
Last edited by pete; 31st March 2010 at 01:59 PM.
31st March 2010, 02:49 PM #2
Can't find anything :-(
There's a property - Document.HasPassword - which will tell you if the document has a password set but it only works on a document which is already open.
I know it's kludgy to just try and open the file and see if it fails but I can't see why this shouldn't be fairly robust - Skipping Password-Protected Documents in a Batch Process is an example of the kind of thing you can do.
Thanks to srochford from:
31st March 2010, 03:52 PM #3
Heh, that's the code I found
By meastaugh1 in forum How do you do....it?
Last Post: 11th June 2009, 11:51 AM
By leco in forum How do you do....it?
Last Post: 13th April 2009, 01:40 PM
By StewartKnight in forum Hardware
Last Post: 6th November 2007, 10:51 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)