Recursively unlock files on Mac OS X
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!
Related posts:
- Finding number of lines in files recursively I wanted to find the number of lines from a...
- Setting up local copy of PHP manual – with smart lookups If you are a PHP developer, you probably know that...
- Collaborating in web application using SVN What would you do if you wanted to manage document...

What is output of ls -l with locked file(s)?
Kartik Mistry
16 Apr 09 at 11:35 pm
is not visible .. its an extended attribute. your are not able to see this…
macdet
16 Sep 09 at 3:40 pm
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
Miles Wolbe
11 Dec 09 at 3:21 am
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.
Chris Thoma
27 Feb 10 at 1:08 pm