After transferring a massive code project to my Mac, I noticed I couldn't write anything to the files inside due to the "File is Locked" plus an access denied message.

Unlocking the root folder didn't help, chmod didn't make a difference, and granting read-write to everyone and applying to all subfiles didn't help either.

Is there a terminal command I can use to programmatically unlock all folders and files below a specific directory?


I found a perfect terminal set of commands buried in a forum post here: https://forums.macrumors.com/threads/how-to-batch-unlock-numerous-files-within-subfolders-folders-directory.453818/

Here's the commands I used (my project was located at /APPS/MYAPP):

find $UNLOCK -type f -exec setfile -a l {} \;
find $UNLOCK -type d -exec setfile -a l {} \;

The type argument is f for files, d for directories.

The exec argument passes setfile, from the xcode developer tools (may need to be installed first), and uses lower-case L to "unlock" (bizarre command line syntax, I know)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .