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.
June 28th, 2008 at 10:31 am
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