How does trash work?

Discussion in 'macOS' started by hyram, Apr 13, 2010.

  1. hyram macrumors regular

    Joined:
    Jun 15, 2009
    #1
    As the title says... how does trash work? As best I can make out it just removes a file from the directory structure and places a link (or something) to it into the .Trashes directory. The file is not actually moved and can be recovered simply by reversing the process. Only when the trash is emptied is the file deleted.... I know, it's not really gone here either, but let's say it is.

    Now here's where my understanding fails, if you have more than one disk or partition there are .Trash files located on every volume. Which one does OS X use for trash? One of them? All of them?

    TIA!
     
  2. spinnerlys Guest

    spinnerlys

    Joined:
    Sep 7, 2008
    Location:
    forlod bygningen
    #2
    All of them.


    Computer A has external HDD connected to it. You delete file/folder X on it (but not empty it).

    You connect the external HDD to computer B and open the Trash on that computer and see the file/folder X you deleted on computer A.
    Now you empty the Trash and plug the external HDD back into computer A and see that file/folder X is gone.
     
  3. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #3
    If you have, for example, a USB flash drive, and delete a file but do not empty the trash and then dismount the usb, the OSx 'trash' icon in the doc shows nothing in the trash. As soon as you plug the disk back in, then the trash icon shows there is something in the trash.

    Each volume has a .trashes where it keeps track of files that have been "moved to trash" but not emptied. When you empty the trash, the space occupied by the file is then released to the volume's free space.
     
  4. MrCheeto macrumors 68030

    MrCheeto

    Joined:
    Nov 2, 2008
    #4
    Any time you plug a drive into a Mac it creates a .Trash folder on THAT drive. My USB sticks and my external drive each has its own .Trash folder.

    If I throw something away that is on my USB stick, then eject it without emptying, my trash may appear empty because there is nothing on my internal .Trash folder. But when I plug the USB stick back in, the trash is occupied by whatever is in the USB stick's .Trash folder.
     
  5. hyram thread starter macrumors regular

    Joined:
    Jun 15, 2009
  6. rdowns macrumors Penryn

    rdowns

    Joined:
    Jul 11, 2003
    #6
    You throw your garbage into it and take it our when the wife screams. :D
     

Share This Page