13 Replies Latest reply: Feb 18, 2011 8:38 AM by jsd2
dc430 Level 1 Level 1 (0 points)
I had some files on my thumb drive. I deleted all the files after copy them to my mac. All files are gone but when i view the info of the thumb drive, it shows that the drive is half full. This always happens when i delete files from my thumb drive on a mac but not on a pc. Is there any way to avoid this? And how do you format a thumb drive on a mac? (I can right click and format my drive on a pc but don't know to do it on a mac)
  • Niel Level 10 Level 10 (281,700 points)
    Is there any way to avoid this?


    Empty the Trash.

    how do you format a thumb drive on a mac?


    With the Disk Utility in the /Applications/Utilities/ folder.

    (56712)
  • dc430 Level 1 Level 1 (0 points)
    Thanks.
    Empty trash on your mac or on the thumb drive?
  • Niel Level 10 Level 10 (281,700 points)
    Control-click the Trash icon in the Dock and empty it on the Mac when the drive's connected.

    (56861)
  • J D McIninch Level 5 Level 5 (4,060 points)
    Empty Trash while the drive is connected.

    When you drag a file to the trashcan, what the computer is really doing is moving the file into a hidden folder called ".Trashes" on the same drive where the file was originally located. In your case, you moved the file from it's original directory on the thumb drive, to the hidden .Trashes directory.

    When you "Empty Trash", the computer will locate the hidden directory on all the attached drives / devices and remove the files from them.

    The reason your thumb drive didn't have the space you expected is because the files were still on the drive, in the Trash.
  • WZZZ Level 6 Level 6 (12,750 points)
    J D Mcininch: When you "Empty Trash", the computer will locate the hidden directory on all the attached drives / devices and remove the files from them.


    My experience is otherwise. E.g. I have found I need to be booted from my external (clone) to empty its trash. I don't know what it is, but there must be some way of doing this from the command line booted from the Mac.

    With the drive mounted, control-clicking on the Trash icon gives me exactly the same options as left-clicking: "Open" and "Empty Trash."
  • WZZZ Level 6 Level 6 (12,750 points)
    Some variation of the rm command to empty the contents of the trash on a selected volume without deleting the entire .Trash Folder?

    OK, found this suggestion from V.K. from a while back.

    rm -rf /Volumes/"drive-name"/.Trashes/`id -u`/*

    http://discussions.apple.com/thread.jspa?threadID=1527696&tstart=90

    Or, am I wrong in thinking emptying the trash doesn't empty it on all connected drives?
  • jsd2 Level 5 Level 5 (6,200 points)
    Hi,

    am I wrong in thinking emptying the trash doesn't empty it on all connected drives?


    My understanding is that emptying the Trash does empty the Trash on all connected drives EXCEPT for any items on a bootable drive that were put into the Trash *while you were booted from that drive*, which is not the case in the OP's situation. There shouldn't be a need here for V.K.'s Terminal command unless you *selectively want to preserve* the Trash on the boot disk, while emptying it on the external volume.

    I have found I need to be booted from my external (clone) to empty its trash.


    Again, I think that should only be true for the items on the clone that were put into the Trash while you were booted from that clone, not for items on the clone that were trashed while you were booted elsewhere. Try it - do you find this?

    The reason is that there can be two separate hidden folders specific for each user on a bootable volume. When you move an item on your startup disk to the Trash, it goes into a hidden folder named .Trash in your home directory. Files on external volumes that are trashed are stored separately, in a hidden .Trashes folder at the root level of each external drive. The external trash is segregated by user, so that the trash belonging to the user whose UID is 501 goes into the .Trashes/501 folder on the external drive, etc. The contents of the separate user-specific trash folders appear together in the single Trash window that you see when you open the Trash icon in the dock.

    So if you boot from your internal HD, navigate to an item on an external drive clone and move that item to the Trash (analogous to the OP's situation), then you would be able to fully delete that item by emptying the Trash while still booted from the internal HD. But if you don't empty the Trash while booted from the startup disk and instead reboot from the clone and look at what is in the Trash, the item won't be there - the item is still in .Trashes/UID on the clone, but since this is now the boot disk, the Trash icon in the Dock is instead looking at the other Trash folder at /Users/username/.Trash. In fact if you empty the Trash while booted from the clone (emptying only the clone's internal Trash , and then reboot to the internal HD, the item will re-appear in the Trash bucket.
  • WZZZ Level 6 Level 6 (12,750 points)
    Thanks very much for that explanation. OK, I realize now that what I was seeing was an item in the external Trash put there when I was booted from the external that wasn't removed by emptying the Trash on the internal. That clears that one up.

    So, next question: will V.K's command work in the above situation in order to empty an item in the external Trash that has been put there +while booted from the external+, or only to preserve the contents of the Trash on the internal when booted from the internal? In other words, using that command won't remove the contents of the Trash if that item or those items were placed there while booted from the external? For that I would still need to be booted from the external to empty it?

    The reason is that there can be _two separate hidden folders_ specific for each user on a bootable volume. When you move an item on your startup disk to the Trash, it goes into a hidden folder named .Trash in your home directory. Files on external volumes that are trashed are stored separately, in a hidden .Trashes folder at the root level of each external drive.


    OK, "two separate hidden folders:" so the first hidden Trash Folder on the startup disk resides in the home directory. That's clear. But then I get a bit confused: are you saying the second, separate hidden Trash on the startup volume exists only if there is an external mounted on the startup Volume, and it exists in another hidden .Trashes Folder which resides at the root level of the mounted -- *but not-booted-from* -- external drive? Am I close to getting that one right? You don't mean there are two separate .Trashes for any given user on the internal. Considering the case of only one user, there is a second .Trash only if there is a mounted external -- or however many external drives may be mounted; i.e. if there were two externals mounted, there would be three .Trashes, including the one at the level of the home directory of the boot Volume?
  • Niel Level 10 Level 10 (281,700 points)
    The Trash folder on a volume which contains the currently in use home folder is ~/.Trash. The Trash folder on a volume which doesn't contain the currently in use home folder is /Volumes/volumename/.Trashes/501 or other number. The number is equal to the account's numeric UID.

    (56870)
  • WZZZ Level 6 Level 6 (12,750 points)
    Niel wrote:
    The Trash folder on a volume which contains the currently in use home folder is ~/.Trash. The Trash folder on a volume which doesn't contain the currently in use home folder is /Volumes/volumename/.Trashes/501 or other number. The number is equal to the account's numeric UID.

    (56870)

    OK, that would seem to apply to any other user in the startup volume. But my question above relates to what jsd2 said about there being two separate .Trash folders on a startup volume. One belongs to the home folder of the startup volume, the other belongs to that mounted, bootable external volume and resides at root there, but is controlled by the startup volume (that is, in the case of a file being moved from that mounted cloned volume to the Trash icon of the Dock)? For this hypothetical I'm considering there is only one user account. If there were only one user and no external boot volumes mounted, there would be only one .Trash folder?
  • jsd2 Level 5 Level 5 (6,200 points)
    There can be two Trash folders on a given volume for each user, but only one is in use at any given time. The ~/.Trash folder is used for what I had called "internal trash," items that were originally on the boot drive. The .Trashes/UID folder is not used when booted from the drive that contains it, it is used when booted from elsewhere.
  • WZZZ Level 6 Level 6 (12,750 points)
    I think I've pretty much got that sorted out now. Things are much clearer now in the morning. (Sadly, I've begun to realize I will never make a contribution to string theory by working on it late at night. )

    Thanks again.
  • jsd2 Level 5 Level 5 (6,200 points)
    I see now from Niel's post that I when I said that ~/.Trash is used for items that are on the boot drive I assumed that the home folder is always located there. This is true for the vast majority of users, but not for everyone.