Unlocking files recursively from the command line.

A few people at X-World seemed interested in this simple one-liner, which will recursively unlock files from the command line.


find /Volumes/Transit -flags +uchg -print0 | xargs -0 chflags nouchg

The command above would look at the path /Volumes/Transit, recursively find any locked files, and unlock them. The '-print0' and '-0' bits will deal with any files or folders that have spaces in them.

NB: It seems like the 'rm' command has changed in Tiger such that if you use 'rm -Rf' with elevated privileges, it will automatically unlock the files. This isn't the case in Panther, which is why I initially needed to do this on a temporary sharepoint that gets wiped nightly.

One Response to Unlocking files recursively from the command line.

  1. I’m doing this from the Leopard CLI…SetFile didn’t seem to work very well, and sudo just wasn’t going to work…I guess I deserve that for creating an administrative user called Adolf Hitler! Anyway, thanks for the tip, I’m off to try it!

    God bless,

    Matthew Chappell

Leave a Reply

Name and Email Address are required fields. Your email will not be published or shared with third parties.