Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Cannot delete locked file

having issues with this locked file I'm trying to delete. When I "Get Info" on the file and try to uncheck the "Locked" button, it will not let me. The check mark just remains. Its on our server and it was worked on by some other designers. Could that be an issue? Because I have privilages to delete image files on the server, but for some reason, it wont let me delete this one. Quite annoying.

User uploaded file

User uploaded fileIm

MacBook Pro, Mac OS X (10.6.7)

Posted on Dec 16, 2011 9:56 PM

Reply
29 replies

Jul 19, 2017 8:17 AM in response to jizzlets

The problem I see here is with your treatment of the file path. One of the directories has a space in its name. The problem with this is when the Terminal sees a space, it thinks you have moved on to parse the next directive for the command being run and your path is truncated at the space and the rest of it is sent as a next command to process which will result in an error. To prevent this, any path/filenames which have spaces must be entered like this:


"path which has directory names with spaces in it/filename"


..thus it directs the Terminal to understand that the whole thing in quotes is a path/file and not another bunch separate switches after the spaces. Ditto for filenames which have spaces in them:


"path/filename with spaces"


As for the use of sudo, it will not show the password while you type so if you typed it three times wrongly, it's 99% likely that it's because you didn't notice caps-lock was erroneously turned on at the time.

Dec 16, 2011 10:51 PM in response to jizzlets

Try the following...


In terminal type sudo rm -f followed by a space. Then open your trash and drag the icon of that file into the terminal. You should then have a line that looks something like:


sudo rm -f path-to-file-in-the-trash


Hit return. Answer the prompt for your admin password (it won't echo) and see if the file deletes.

Dec 17, 2011 5:15 AM in response to X423424X

That's what I should've tried first. And it may work, but, man! I look at that AFP path and I wonder if it could have anything to do with it. Not only does it look rather long, but it also includes a special character. Just to be on the safe side, you should keep AFP directory paths short (not longer than 88 characters, including the 'slashes'), and use only ASCII alphanumeric characters, plus hyphen and underscore.

Dec 18, 2011 3:06 AM in response to X423424X

The OP cannot remove the locked flag from a file on an AFP share. Remove may (or may not) delete the file, but, even if remove is successful, it does not explain why the OP cannot remove the locked flag. There are various possibilities, and one of them (I say possibility, not probability) is that the command fails due to the path -- which is long, contains blanks, and, by the looks of it, at least one special character.


Apple recommends that AFP and NFS network home directories should have paths of less than 89 characters and not contain spaces. This suggests that problems may occur with long pathnames (even if not of home directories). Hence my suggestion. Even if it has nothing to do with removing the locked flag, IMHO what I suggested was good practice for AFP and NFS volumes, which lessens the potential for trouble, while not imposing an unbearable burden on the users.


Clear as mud?

Dec 19, 2011 9:40 AM in response to jizzlets

the issue is, i cannot seem to put the file into the trash. it keeps telling me that the file is locked. but when i try to uncheck the lock, it will not let me for some stupid reason.


I was wondering if there is a way to force the file to go to the trash, even though it is locked. i was hoping its some terminal jibber-jabber that i need to type in. 🙂

Dec 19, 2011 11:41 AM in response to jizzlets

The following is not going to delete the file but I just want to see the permissions, owner and group settings not using the finder. This is similar to the operation I described earlier for the rm command. So in terminal type ls -l followed by a space and drag the icon of that file from the finder into the terminal window.


ls -l path-to-file


Post the output.

Dec 19, 2011 5:31 PM in response to jizzlets

You never replied whether the rm I asked you to try worked or didn't work. But I assume since the thread continued after that it didn't. But what exactly happened? Did it produce an error on the terminal like "No such file or directory"?


The reason I ask is that looking at your first post you show the filename as the finder reports it:


User uploaded file


Looking at the ls command however,


User uploaded file


It appears that that special character after "Appliance" may be confusing things a bit. The " Home Theater" portion of that pathname component is missing. So is " Folder" in the "Scratch pads_export Folder" component. Either it's just not printing in that terminal line or it's not there, in which case that would explain why the rm suggestion failed.


Of course why did the ls command work if that stuff was actually missing? But maybe while the terminal can handle it, I suppose there is the possibility of confusing other code which is may be why you are having problems clobbering this file.


The read/write for owner/group/others is nothing special and I assume that the owner:group is valid. So I see nothing special there. Maybe it is that weird character fouling up things.


Question now of course is, if it is that character, how to get it out of there?

Dec 19, 2011 6:34 PM in response to jizzlets

jizzlets wrote:


i was hoping its some terminal jibber-jabber that i need to type in. 🙂

X423424X has already given you the jibber-jabber -- it's the remove command. "Sudo" says the command should be executed with admin privileges, "rm" is the actual command, and "-f" says it should be done no matter what. This command should delete (not put in Trash) the file right away. Have you tried it? What happens?


If it doesn't work, I'd try the other command X423424X suggested, "ls", but I'd add the "O" switch ("ls -lO"), which should show if the file has any special flags.


I'm not sure, though, that deleting a JPEG, even if it's 28M, is a big problem. If I were you, I'd work first on re-organising the AFP share as I described above, with short paths containing no blanks and no special characters.

Cannot delete locked file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.