Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

InfiniteLoop

macrumors member
Original poster
Nov 13, 2005
55
0
How annoying :mad: I am trying up create a back up copy of my home directory, my mac tells me some destination file is locked so it cannot be overwritten. I do not know how it got locked (whole bunch of files are locked), but whatever I try fails (when I try to change the ownership it asks for the admin password, I give it, then it says you do not have privileges to do that!). I do not have the privileges to change them. Very strange, I created those files by copying from my mac to an external HD. Any ideas how I can fix this?

I cannot even delete the files. When I deleted them it put them all in the trash. But now I cannot empty trash because the files are locked! How can I get rid of those in my trash?
 
OK, I was able to clean up the trash by doing this:

sudo rm -rf /Volumes/250GB_2/.Trashes/501/My\ Pictures


But how do i fix the locked files? If i do them one by one it works, but doing wholesale does not work :(
 
Answering my own question, I found that the magic command is:

sudo chflags -R nouchg /Volumes/250GB_1/My\ Pictures/

This command clears the 'lock' flag from all files under My pictures. :)

Why oh why it could not do this from Finder :mad:
 
The Mac OS lock flag is used to lock files that you do not want to be overwritten by a new install. It does not make sense why user files are locked.
 
I've always had to unlock them one at at time, but I'm sure someone will know a way to do a batch unlock .... :confused:

I already provided the answer to that:

sudo chflags -R nouchg /path/to/files/to/unlock

you will need to enter admin password. This will unlockes all files (any others in sub folders there in) under the path given.
 
I already provided the answer to that:

sudo chflags -R nouchg /path/to/files/to/unlock

you will need to enter admin password. This will unlockes all files (any others in sub folders there in) under the path given.

i'm having a similar problem. i can't sync my ipod because i do not have sufficient write privileges. however, i looked at every folder in my music folder and they all say i can read and write. i've also tried to repair permissions and reinstall itunes. nothing is working.

if i try the following command, what would it look like if i were trying to unlock all files in my music folder?

sudo chflags -R nouchg /Users/Me/Music/unlock?
 
i'm having a similar problem. i can't sync my ipod because i do not have sufficient write privileges. however, i looked at every folder in my music folder and they all say i can read and write. i've also tried to repair permissions and reinstall itunes. nothing is working.

if i try the following command, what would it look like if i were trying to unlock all files in my music folder?

sudo chflags -R nouchg /Users/Me/Music/unlock?

It would be something like /Users/<user name>/Music
 
Hi everyone, my first post :D.

Im having a similar problem in that, I have mp3 files which I have copied from my external HD. then I have sent the files to trash but cannot proceed to delete permanently.

I dont know how the file becomes locked? When i go to "get info" under the ownership and permission section i change owner to myself and the padlock opens up, followed by a prompt saying "an unexpected error occured (error code 120)"

Im not understanding the procedure you guys are talking about. Any help would be great because these files have been sitting in my trash for months.

thanks.
 
Welcome to the community Andre :)

Try this, start trerminal program and then enter the following, substituting your username where you see "<your user name>"

sudo chflags -R nouchg /Users/<your user name>/.Trash

Then hit enter. It will ask for admin password, enter that. After this you should be able to empty trash.

Hi everyone, my first post :D.

Im having a similar problem in that, I have mp3 files which I have copied from my external HD. then I have sent the files to trash but cannot proceed to delete permanently.

I dont know how the file becomes locked? When i go to "get info" under the ownership and permission section i change owner to myself and the padlock opens up, followed by a prompt saying "an unexpected error occured (error code 120)"

Im not understanding the procedure you guys are talking about. Any help would be great because these files have been sitting in my trash for months.

thanks.
 
Thanks for the response InfiniteLoop :)
unfortunatly im a bit of a newbe with this type of thing so bare with me...
I have opened up the terminal app but all it says is

"Last login: ******* on console
Welcome to Darwin!
andre's-computer:- Andre"

it does not let me substitute any name either. I can however enter the sudo you gave me below but it warns me it could be risky so i didnt want to continue yet.

any help would be good,
thanks again


Welcome to the community Andre :)

Try this, start trerminal program and then enter the following, substituting your username where you see "<your user name>"

sudo chflags -R nouchg /Users/<your user name>/.Trash

Then hit enter. It will ask for admin password, enter that. After this you should be able to empty trash.
 
You do not need to log in as admin to this. You will get a prompt to enter the password, (the same one you get asked when you are installing software or changing system settings etc). So in the terminal program being logged in as yourself is OK.

As for the risks of the 'sudo' command, well it will be operating on all the files in your trash basket (as long as you type it as I said with /.Trash at the end). Do not worry about the warning. It will not delete anything from trash, but it will allow you to delete them if you want to after you executed this command.

Thanks for the response InfiniteLoop :)
unfortunatly im a bit of a newbe with this type of thing so bare with me...
I have opened up the terminal app but all it says is

"Last login: ******* on console
Welcome to Darwin!
andre's-computer:- Andre"

it does not let me substitute any name either. I can however enter the sudo you gave me below but it warns me it could be risky so i didnt want to continue yet.

any help would be good,
thanks again
 
Did anyone else assume this thread was going to be about denial of conjugal rights?
 
what does this thread have to do with conjugal rights?

Did anyone else assume this thread was going to be about denial of conjugal rights?

thanks to infinateloop, ill give it a try when i get home.
 
what does this thread have to do with conjugal rights?

BashHead.gif
 
After performing backups to my Firewire drive I got hit with this issue again :mad: I ended up with files in my trash that I could not empty. This happened after I deleted a few folders on my external FW drive. So whatever happened (well appears to be a nasty Tiger OS bug, as I am still on OS 10.4) after I deleted my own files (files from mypictures folder) I was not able to remove them from the trash (on the external drive, when you delete files from an external drive the OS moves those files to a folder under .Trashes of that drive). And that is why I am writing this. Because you may actually have files in your trash that are on an external drive (visible when the said external drive is connected to your mac). So to remedy all this I used the command:

sudo rm -rf /Volumes/<volume name>/.Trashes/*

you need to put the name of your external drive instead of <volume name>

Warning, be very careful with this command, especially after you have entered the admin password once. Since after that if you hit enter with the wrong command you have no way to undo it! But as long as you are deleting the trash contents it is no big deal since you do not want those files anyway

Now if only I knew this issue has been fixed on Leopard I might spend the $108 and get it...

You do not need to log in as admin to this. You will get a prompt to enter the password, (the same one you get asked when you are installing software or changing system settings etc). So in the terminal program being logged in as yourself is OK.

As for the risks of the 'sudo' command, well it will be operating on all the files in your trash basket (as long as you type it as I said with /.Trash at the end). Do not worry about the warning. It will not delete anything from trash, but it will allow you to delete them if you want to after you executed this command.
 
I have the same issue, and tried both of the commands that you suggested (the one if the trash is from the HD and the one if the trash is from an external HD). I didn't know they were from the external hard drive until I went to get info.

Here is what I entered in terminal (replacing "<name of my external drive>" with the name of my external drive:

sudo rm -rf /Volumes/<name of my external drive>/.Trashes/*

Still get the same error.

Btw, they are empty folders, not files, if that makes any difference. And there are empty folders inside of empty folders inside of empty folders (well, empty except for the empty folders inside of them).

Ideas?

TIA
 
I have the same issue, and tried both of the commands that you suggested (the one if the trash is from the HD and the one if the trash is from an external HD). I didn't know they were from the external hard drive until I went to get info.

Here is what I entered in terminal (replacing "<name of my external drive>" with the name of my external drive:

sudo rm -rf /Volumes/<name of my external drive>/.Trashes/*

Still get the same error.

Btw, they are empty folders, not files, if that makes any difference. And there are empty folders inside of empty folders inside of empty folders (well, empty except for the empty folders inside of them).

Ideas?

TIA

Try entering this command first:

sudo chflags -R nouchg /Volumes/<name of my external drive>/.Trashes

Now you should be able to delete them.
 
Try entering this command first:

sudo chflags -R nouchg /Volumes/<name of my external drive>/.Trashes

Now you should be able to delete them.

I tried it and these were the errors I got:

chflags: /Volumes/TOSHIBA: No such file or directory
chflags: EXT/.Trashes: No such file or directory

The name of my external is TOSHIBA EXT. I think the space through it off. But when I go to "Get Info" for the files, the path does include the space. What do you suggest?
 
You need to escape the space in the folder name using '\' like this:

sudo chflags -R nouchg /Volumes/TOSHIBA\ EXT/.Trashes
 
You need to escape the space in the folder name using '\' like this:

sudo chflags -R nouchg /Volumes/TOSHIBA\ EXT/.Trashes

OK. Thanks. For whatever reason, the troublesome folders are not there anymore. Not sure if it was after I rebooted or what, but thanks for the help!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.