I copied some songs from a CD and ended up with a folder full of locked files. iTunes can’t save changes to song info (ID3 tags) until I unlocked them. How can you unlock files recursively on Mac OS X?
If you have a folder full of locked files on Mac OS X, you can quickly unlock all of them recursively with the following command. Open a Terminal, go to the folder containing locked files, and type:
chflags -R nouchg *
An excellent introduction to chflags on Mac OS X Hints. Here’s an excerpt:
In addition to the standard UNIX permissions (read, write, execute for owner, group, other), OS X has a few flags that can be set on files and folders to make them locked.
These flags supersede the standard UNIX permissions. If a file is locked, that overrides the write permissions so that applications treat the file as read-only. If a folder is locked, no files can be added or removed from that folder, no matter what the write permissions on the folder are. These restrictions apply to all users, independent of the permissions that are set on the files or folders. They even apply to the root user (or to admin users using sudo).
Read more about chflags at Mac OS X Server FAQ.
HTH!
What is output of ls -l with locked file(s)?
is not visible .. its an extended attribute. your are not able to see this…
However, you can use the -O (capital “o”) switch to view file flags:
$ ls -lO
-rw-r–r– 1 user staff uchg 0 Dec 10 11:50 locked_file
-rw-r–r– 1 user staff – 0 Dec 10 11:50 unlocked_file
Just wanted to give you a big fat THANKS! This was driving me nuts with a huge folder of some locked / some unlocked files. Went a lot easier and faster than I expected, and I appreciate you taking the time to post that little command.
Hi – this is fantastic – same as the guy above, this was driving me insane having to go into thousands of locked files on a Time Capsule
Cheers!
Great tips! 3 years later, it’s still helping someone. Cheers.
Thanks Buddy
I did not know the use of the terminal window.
I used to transfer videos shot by me on CF card in my Mac, but they were all locked. I used to unlock them manually. This has been of great help
Cheers.