PDA

View Full Version : Can Not Delete Files from Trash



Warrys
21st October 2007, 06:19 PM
I want to delete some files in my trash.

When I try to delete a message appears -

"The operation cannot be completed because the item vssver2.sec is locked"

I cant find how to unlock file - I have looked in Get Info it does not show file locked

Can any one help

Thanks Very much

rickyd
21st October 2007, 06:24 PM
I want to delete some files in my trash.

When I try to delete a message appears -

"The operation cannot be completed because the item vssver2.sec is locked"

I cant find how to unlock file - I have looked in Get Info it does not show file locked

Can any one help

Thanks Very much

I think in Terminal


rm -rf .Trash/vssver2.sec

will work.

Ricky.

Ed01
21st October 2007, 06:27 PM
I use the "Secure Empty Trash" functionality when a file won't delete. It usually works.

Warrys
21st October 2007, 06:34 PM
Thanks

I tried the delete secured files and it does not work.

Get the same message

rickyd
21st October 2007, 06:35 PM
Thanks

I tried the delete secured files and it does not work.

Get the same message

Did you try the Terminal command I supplied?

MacDave
21st October 2007, 06:51 PM
Did you try the Terminal command I supplied?

This would be safer:

cd ~/.Trash;rm -rf *

It will delete all files in the Trash put there from the boot drive. First it changes directory to the trash. Then it uses the UNIX wildcard to delete everything within ~/.Trash

Dave

Currawong
21st October 2007, 09:11 PM
Click on (select) the file that wont delete.
Press command-i (or select "Get Info" from the file menu).
Uncheck the "Locked" checkbox.
Empty trash.

You can't "rm" locked files in the terminal.

dotnet
21st October 2007, 10:30 PM
This would be safer:

cd ~/.Trash;rm -rf *


No Dave, that's bad advice. The combination of "rm -rf" and * is never safer. A typo anywhere before the semicolon could make the cd command fail, and rm will then proceed to happily wipe out anything in your current directory and underneath. With a bit of (bad) luck the current directory is the home directory...

Cheers
Steffen.

samwalk
21st October 2007, 10:31 PM
I have normally used an application called xray to 'unlock' files which I couldn't delete.

dmg
24th October 2007, 12:46 AM
To delete most locked files hold down the Option key, then choose Finder > Empty Trash.

Or use the shortcut keys:
⌘-Shift-Option-Delete.

Hope that helps.

Dale

AusMac
24th October 2007, 01:43 AM
Click on (select) the file that wont delete.
Press command-i (or select "Get Info" from the file menu).
Uncheck the "Locked" checkbox.
Empty trash.

You can't "rm" locked files in the terminal.
Let's put this in order for non terminal implanted users.
If a file won't delete ... because some may be switchers.. Mac also gives confusing error messages.
There are many situations where a file gives errors on delete
There are even I think three different way a file can be locked (not in use, but locked) under osx
Currawong's suggestion is the first thing to try(after quitting the app or all apps which may be running the file). Nine point nine times out of ten this will do the job.

remember this:
that OS X will not allow you to put a locked file in the trash. However it will allow you to lock a file while in the trash and after that Command/Shift/Delete .. will remove it .. locked or not.

Probaly the best solution is put in trash and restart
•then empty trash.
if it still does not go..

Only then do you really need to start thinking about using powerful tools like using the Terminal. or google? http://www.google.com.au/search?q=&btnmeta%3Dsearch%3Dmac=Search+Mac+Sites=googlet&q=

Older versions of OS X had more limitations in the finder
Tiger prompts you for a password if you don't have permission to trash a file.
http://www.osxfaq.com/Tutorials/LearningCenter/HowTo/Trash/page2.ws
looks good
I have not looked into whether it is 100% correct for latest os x
the system immutable is an interesting option, very rarely used.

MacDave
24th October 2007, 02:55 AM
No Dave, that's bad advice. The combination of "rm -rf" and * is never safer. A typo anywhere before the semicolon could make the cd command fail, and rm will then proceed to happily wipe out anything in your current directory and underneath. With a bit of (bad) luck the current directory is the home directory...

Cheers
Steffen.


So, check the current working directory with "pwd" before deleting.

[dsl092-002-148:~/.Trash] dave% pwd
/Users/dave/.Trash

Also, if it's genuinely a concern, though I don't see why it would be just copy/pasting a command, one can use the 'i' flag with rm:

-i Request confirmation before attempting to remove each file,
regardless of the file's permissions, or whether or not the
standard input device is a terminal. The -i option overrides
any previous -f options.


This advice is bad because it assumes that one is already in their home directory. Just because a new terminal window defaults to ~ as the current working directory, that should never be assumed.

rm -rf .Trash/vssver2.sec

Hence, I suggested my method to change directories to ~/.Trash first.

So, to appease you, I suggest the following:

cd ~/.Trash

pwd

rm -ri <filename> or rm -ri *

[dsl092-002-148:~/.Trash] dave% rm -ri *
remove IMG_3477.JPG? yes
remove IMG_3480.JPG? no
remove IMG_3483.JPG?

Dave

AusMac
24th October 2007, 03:04 AM
Hence the way I wrote it up .. not everybody uses the terminal and not everybody has a full grasp of its power.

MacDave
24th October 2007, 03:10 AM
Hence the way I wrote it up .. not everybody uses the terminal and not everybody has a full grasp of its power.

Knowledge is power. Learning a bit of UNIX is increasing one's knowledge, hence increasing their power!

Dave

AusMac
24th October 2007, 03:13 AM
no denying that .. ;)

MacDave
24th October 2007, 03:16 AM
Click on (select) the file that wont delete.
Press command-i (or select "Get Info" from the file menu).
Uncheck the "Locked" checkbox.
Empty trash.

You can't "rm" locked files in the terminal.

You can sudo rm locked files in the trash. It just asks for permission first:

[dsl092-002-148:~/.Trash] root# rm -r *
override rw-r--r-- dave/dave uchg for Picture 1.jpg? yes

Picture 1.jpg is a locked file.

If files in the trash will NOT delete and they are NOT locked, one can check which application is using the file in the trash by doing like so:

lsof | grep <filename>

Where <filename> is the name of the file in the trash that doesn't want to delete.

Also, one can unlock files in Terminal:

http://macdave.com/chronicles/viewtopic.php?t=32

Ironically, Brains dug this command up ages ago when a few of us were chatting on #apple. =)

Dave

Johnny Appleseed
24th October 2007, 06:00 AM
Knowledge is power. Learning a bit of UNIX is increasing one's knowledge, hence increasing their power!

Yeah, but holding down the option key is just plain easier!