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

Move user's trash can to a new location Desktop
It would often be convenient to have Mac OS X store your Trash in a location outside of the home folder, to make backing up your computer easier. I have discovered that this is possible by issuing the following commands from the Terminal. Be sure you're ready to empty your current trash, because the first command does that!

rm -r ~/.Trash
ln -s ~/.Trash /path/to/new/Trash/location
That's it! Remember to replace "/path/to/new/Trash/location" with the actual path to the directory where you'd like to put your trash. For example:

ln -s ~/.Trash /MyTrash
[robg adds: This should work and not break anything, as the symbolic link should appear just like the "real" trash can to anything that tries to access it. I haven't tested this one myself, however.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[10,624 views]  

Move user's trash can to a new location | 15 comments | Create New Account
Click here to return to the 'Move user's trash can to a new location' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Move user's trash can to a new location
Authored by: blueoak on Aug 22, '03 12:12:15PM

Cool. Now how do I change the icon of the alias/symlink from the generic folder to the nifty trash can graphic you see in the dock?



[ Reply to This | # ]
Move user's trash can to a new location
Authored by: blueoak on Aug 22, '03 04:16:36PM

Answered my own question:
http://everythingmacintosh.com/technotes/go.em/General/86



[ Reply to This | # ]
Move user's trash can to a new location
Authored by: sevenoftoine on Aug 25, '03 01:57:10PM

And in general, backup programs should *not* follow symbolic links. For example, if you have a symlink that points back up a directory (to ..), it will follow the links forever/forever/forever/forever...



[ Reply to This | # ]
Move user's trash can to a new location
Authored by: klktrk on Aug 22, '03 12:14:54PM

Those of you tempted to use this hint to move your trash onto a separate volume should remember that that will slow down your trashing quite a bit, since files will have to be copied to the new volume rather than moved. If you are moving large files to the trash, that could really take a while.



[ Reply to This | # ]
Move user's trash can to a new location
Authored by: Auricchio on Aug 22, '03 01:10:14PM

But if it's a symbolic link, what prevents your backup program from blindly following the link and backing up the trash anyway?

---
EMOJO: mojo no longer workin'



[ Reply to This | # ]
Move user's trash can to a new location
Authored by: bkazez on Aug 23, '03 10:42:09AM

In response to the question about backup programs: This depends entirely on the backup program. A more sophisticated program such as Retrospect should be able to be configured to follow or not to follow symlinks and aliases. Any backup program run from OS 9 will definitely not follow the symlinks, though.

Ben



[ Reply to This | # ]
Move user's trash can to a new location
Authored by: Anonymous on Aug 22, '03 06:06:26PM

My home directory lives on an NFS volume. In older versions of OSX (<10.2) the trash was simply ~/.Trash and everything worked fine. But now I get a message like "The item XXX will be deleted immediately. Are you sure you want to continue?"

If I try to trash something from my ~ directory (as opposed to somewhere else like ~/Desktop), then I get "Sorry, the operation could not be completed because an unexpected error occurred (Error code -8083)."

I'd love to have a working Trash again for my NFS home dir. Any suggestions?



[ Reply to This | # ]
Hint is backwards ...
Authored by: dhrakar on Aug 23, '03 12:42:29AM
Unfortunately, this tip is backwards. When creating a symbolic link, the syntax is (from the man page):
ln [-fhns] source_file [target_file]
Thus, the tip example should have been:
ln -s /path/to/new/trash ~/.Trash

[ Reply to This | # ]
Hint is backwards ...
Authored by: bkazez on Aug 23, '03 10:58:31AM

The command in the hint is actually correct. The man page is a little misleading in the names they give the arguments. By source_file they mean the original file (see DESCRIPTION, which is immediately below SYNOPSIS). Since ~/.Trash is the original file, it should come first in the argument list.

If you're still doubtful, try the command out yourself.



[ Reply to This | # ]
Hint is backwards ...
Authored by: Frederico on Aug 23, '03 02:30:04PM

I agree with the first reply; the original syntax is backwards.

For the second reply, indeed, try the command yourself.

it has always been:

link (symbolically) [to this real file/folder] [from this symbolic location/name]

Thus, e.g.:

ln -s /Volumes/OtherDisk/OtherDirectory/TargetDirectory /Volumes/OriginalDisk/OriginalDirectory/NameOfActualSymbolicLinkThatUsuallyMatchesTargetDirectory



[ Reply to This | # ]
Hint is backwards ...
Authored by: dhrakar on Aug 23, '03 03:20:35PM
Having used the ln command many times in the past, I'm still doubtful ;-) For the purposes of ln, source refers to the original, existing file or directory and target refers to the destination. That is, the intent is to use target as a substitute for source. Thus, you could look at it like
ln -s file-i-want-to-get-to local-file-substitute
So, in your case, you want to get to the 'real' trash location when you go to ~/.Trash so ./Trash becomes the target and not the source. Yes, it can be confusing :-/

[ Reply to This | # ]
Hint is backwards ...
Authored by: srowen on Aug 23, '03 04:14:31PM

No, the example in the hint is in fact backwards.

You're right about the syntax of ln, but "~/.Trash" is *not* the real directory being linked to. The point is that the trash is being moved to something like "/MyTrash", and "~/.Trash" is being changed to a symbolic link. "/MyTrash" is the source file, and "~/.Trash" is the target, so the arguments in the tip should be reversed.



[ Reply to This | # ]
Clarifications
Authored by: bkazez on Aug 23, '03 08:59:23PM

It appears I submitted my hint to hastily! First of all, those of you who said the order was wrong were correct. Quoting from "Sam's Teach Yourself UNIX":

Issue the ln command as ln -s .

And I discovered it takes two more steps to complete the location change.

So, to change the location of your trash, first type these two commands at the Terminal:

ln -s /path/to/new/trash ~/.Trash
mkdir /path/to/new/trash

Then, choose Force Quit from the Apple menu and relaunch the Finder.

Your Trash should now be successfully redirected.

Ben

[ Reply to This | # ]
Move user's trash can to a new location
Authored by: seedy on Aug 24, '03 01:55:00AM

This is probably a stupid question, but I read somewhere that the Trash in OS 9 is also affected by the Trash in OS X, does this affect that?

---
If a man says something in the forest and no woman is around to hear him, is he still wrong?



[ Reply to This | # ]
Move user's trash can to a new location
Authored by: bkazez on Aug 24, '03 10:59:18AM
This is probably a stupid question, but I read somewhere that the Trash in OS 9 is also affected by the Trash in OS X, does this affect that?

The Trashes from OS 9 and OS X are totally separate. I alternate using Mac OS 9 and Mac OS X on my computer, and the Trashes never interfere with each other. That's because in OS X, the Trash is stored for each user: /Users/~user/.Trash. In OS 9, there's only one: /Trash.



[ Reply to This | # ]