Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Locked files and Mac OS X' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Locked files and Mac OS X
Authored by: renderhead on Jan 21, '05 04:35:18PM
Using other comments in this thread for reference, I managed to put together the following procedure for unlocking every file in a directory and all of its sub-directories. When a file is "locked" by OS X, it is applying what *nix calls a "flag" to the file. In this case, the flag is "uchg", which means that no user, even root, can alter the file in any way until the flag is removed. You can use the command chflags to remove the flag.

The following example should unlock every file in your home directory:

sudo chflags -R nouchg ~/
Here's a breakdown of the command:

sudo will run the chflags command as root (you may be prompted for your root password).

-R will cause the command to affect every file in the directory and all of its subdirectories. Yes, capitalization matters.

nouchg is the syntax for removing the uchg flag. Any flag can be removed by putting "no" in front of it.

You can of course substitute the tilde (~) with whatever directory path you want to affect. To change an individual file, leave out the -R and type the file path instead of a directory path. Normal operators apply, such as $ and *.

[ Reply to This | # ]

For the Trash...
Authored by: renderhead on Jan 21, '05 04:48:57PM
To apply my above hint to items already in the trash, use:
sudo chflags -R nouchg ~/.Trash
To empty the trash entirely, add a simple
rm -f ~/.Trash/*
I'll bet someone who knew their applescript could write up a simple "Force Empty Trash" menu item based on those two commands.

[ Reply to This | # ]