Deleting Locked Files in OSX

During the migration of the data on my dad's (*cough*) Windows computer to his new iMac, we ran into lot's of locked files. Usually you get the information on a specific file (⌘ + i) and deselect the 'Locked' option in the 'General' part. It's basically impossible to remove all the locks by hand, so I needed a quicker way to remove these locks.

It seems that there's a command available in Terminal to do this. The following command removed the Locks from all the files in the current directory AND all the sub-directories.

chflags -R nouchg *

More info on the chflags command can be found in the Terminal by typing man chflags, or by visiting this page.

The cause of the locked files in my case was that we copied the data from a read-only network share (to prevent that information might get lost in copy/move actions during the migration). Reading from read-only media results in locked files (or so it seems).

Posted on October 26, 2009 and filed under Apple, Switched2Mac, Tips'n Tricks.