Is it possible to search for password protected Microsoft office (word or excel) files? I have forgotten some passwords and am trying to recover them. I noticed a password protected file is not 'locked' per se, it just has a lock symbol for preview. Is there something that can be put into the Terminal? I tried finder security, it does NOT work at all. Thank you screen shot

1 Answer 1


You can use mdfind in Terminal like so:

mdfind "kMDItemSecurityMethod == 'Password Encrypted'" 

It will print all the files that are password encrypted.

  • On Monterey, lists a lot of pdf files but not the password-protected Word or Excel files.
    – Alper
    Commented Aug 16, 2022 at 9:19
  • 2
    Ok I didn't know that I have no Word nor Excel installed on my machine, so I can't check if those files have anything stored in their metadata. Please run mdls FILE_TO_CHECK.doc and see if there's anything related to password protection. Commented Aug 16, 2022 at 9:43
  • 2
    Sadly, I don't think a Spotlight search (either in Finder or mdfind) can work, because (by experiment) the Spotlight Importer for Word (and I assume Excel) does not populate any suitable Spotlight metadata related to password-protection.
    – Gilby
    Commented Aug 16, 2022 at 10:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .