Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In earlier versions of Mac OS X one could delete a file from the trash by opening a terminal window and typing rm ~/.Trash/file_i_want_to_delete. See this previous post.

Unlike earlier versions in Mac OS X Snow Leopard one can "put back" a file from the trash into its original directory.

Will the rm trick still work? Testing shows it does delete the file but what happens to the "put back" information that specifies the directory from which the file was deleted?

share|improve this question

Mac OS X isn't updating the resource fork:

If you create a testfile on the desktop (plain text file), test.txt, check if the file has a resource fork by going into the terminal and executing:

cd ~/Desktop
ls -l test.txt
ls -l test.txt/rsrc

This lists the size of the textfile and secondly the size of the resource-fork (rsrc). If this rsrc size is 0, there is no resource-fork available for this file. If all is well, there is no resource-fork.

Put the file from the Desktop in your Trash folder. Then in the terminal do the following:

cd ~/.Trash
ls -l test.txt/rsrc

It still does not show a resource-fork here.

On to the .DS_Store file in the .Trash folder: Install a hex-editor (i.e.: )

Put the test.txt file back. (and close the finder window with the trash folder.) Open the hex-editor from the terminal with the .DS_Store file:

cd ~/.Trash
/Applications/Hex\\ Fiend .DS_Store 

As you can see it's almost empty (turn off the option to show hexadecimal.) Close the hex-editor.

Trash the test.txt file and reopen the .DS_Store file in the hex-editor. Now you see the originating path of the file and the current filename in the trash folder.

So indeed the put-back information is put in the .DS_Store file.

share|improve this answer

The "put back" informations are stored in the .DS_Store file in the Trash folder.

Every time you put another file into the Trash, Mac OS X updates the .DS_Store file.

If you delete a file manually (with the rm command), Mac OS X won't update the .DS_Store file in the Trash.

You could still remove manually files from the Trash, but the .DS_Store won't be deleted and will be sightly bigger over the time.
So you should sometimes delete the hole Trash.

share|improve this answer
Thanks. OS X does update .DS_Store if I delete a single file only if .Trash is open in a finder window. If .Trash is not open in the finder .DS_Store does not seem to be updated. However, it is updated the next time I open .Trash in a finder window. I think the suggestion you make to empty the trash every so often in the apple-approved way should take care of everything. – SteveTheOcean Feb 14 '10 at 19:58

My guess would be that that information is stored somewhere in the file link text, be that the .DS_Store file or the resource fork of the actual file. Either way it isn't going to accumulate or build up too much.

share|improve this answer
Thanks. I think you are right and emptying the trash every so often should take care of any extraneous data that is lying around. – SteveTheOcean Feb 14 '10 at 20:00

You must log in to answer this question.