# No trash

**URL:** <https://forum.xojo.com/t/no-trash/45454>\
**Category:** macOS\
**Created:** [September 22, 2018, 8:35am UTC](https://forum.xojo.com/t/no-trash/45454 "2018-09-22T08:35:00Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [September 22, 2018, 8:35am UTC](https://forum.xojo.com/t/no-trash/45454/1 "2018-09-22T08:35:00Z")

</div>

When opening a file from my app there is a check if the folderitem is in the trash. Just got a report from a customer that there is no trash found:

` dim theTrashFolder as FolderItem = theFolderitem.TrashFolder
  if theTrashFolder = Nil then 
    globals.theErrorLog.LogItem "trash is nil"
    theTrashFolder = SpecialFolder.Trash
  end if
  if theTrashFolder = Nil then
    globals.theErrorLog.DialogErrorProceed(kErrorNoTrash)
    Return False
  end if`

Any idea what might be wrong with this code? System of the customer is High Sierra.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [September 22, 2018, 8:55am UTC](https://forum.xojo.com/t/no-trash/45454/2 "2018-09-22T08:55:08Z")

</div>

I’m creating the trash folder if there isn’t one with the appropriate CreateTrashFolderMBS function.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [September 22, 2018, 10:49am UTC](https://forum.xojo.com/t/no-trash/45454/3 "2018-09-22T10:49:10Z")

</div>

The problem is on the system of the user. He seems to have lost his trash.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 22, 2018, 11:09am UTC](https://forum.xojo.com/t/no-trash/45454/4 "2018-09-22T11:09:24Z")

</div>

Each Hard Disk have its own Trash. The contents of each Trash is displayed just ike if it is in the Boot Hard Disk.

---

<div class="post-metadata">

**Author:** ![José\_María\_Terry\_Jiménez](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@José\_María\_Terry\_Jiménez](https://forum.xojo.com/u/Jos%C3%A9_Mar%C3%ADa_Terry_Jim%C3%A9nez)\
**Post date:** [September 22, 2018, 11:49am UTC](https://forum.xojo.com/t/no-trash/45454/5 "2018-09-22T11:49:40Z")

</div>

> [@406816:@Emile Schwarz](#):
>
> Each Hard Disk have its own Trash. The contents of each Trash is displayed just ike if it is in the Boot Hard Disk.

Trash is a user environment thing, not a disk one. It’s a folder under home’s user (or something similar under windows)

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [September 22, 2018, 12:27pm UTC](https://forum.xojo.com/t/no-trash/45454/6 "2018-09-22T12:27:24Z")

</div>

As my code shows the user has lost all his trashes. I made him a small test app with CreateTrashFolderMBS and different domains (user and appropriate disk). And still no trash.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 22, 2018, 2:57pm UTC](https://forum.xojo.com/t/no-trash/45454/7 "2018-09-22T14:57:13Z")

</div>

> [@406820:@JosMaraTerryJimnez](#):
>
> Trash is a user environment thing, not a disk one. It’s a folder under home’s user (or something similar under windows)

Read the Apple documentation and you will learn some things

---

<div class="post-metadata">

**Author:** ![Arnaud\_N](https://forum.xojo.com/user_avatar/forum.xojo.com/arnaud_n/32/21824_2.png) [@Arnaud\_N](https://forum.xojo.com/u/Arnaud_N)\
**Post date:** [August 26, 2019, 11:18am UTC](https://forum.xojo.com/t/no-trash/45454/8 "2019-08-26T11:18:58Z")

</div>

> [@406820:@JosMaraTerryJimnez](#):
>
> Trash is a user environment thing, not a disk one. It’s a folder under home’s user (or something similar under windows)

If this was the case, what would you expect to happen when the user connects an external HFS+ disk to the Mac (or already has several disks/volumes mounted), select a random file/folder in that volume and put it to the trash (a fairly regular operation)?  
Given your statement, the selected item would have to be moved to /Users/username/.Trash (the user’s trash folder) from the source volume. This implies the data must be transferred (read from source volume then written to the target volume). Try it yourself: temporarily put one big file (or one big folder) on another volume than the startup volume to the trash from the Finder (or using the Terminal or other files browsers): this is done immediately, no read/write done (except reassigning the parent folder, which is immediate). Logically, there have to be trashes on each volume. This is indeed the case. Mount an arbitrary volume to your mac (works, at least, with HFS+ and Fat32 volumes) and look at invisible items it contain ((1) show invisibles files in the Finder or (2) use the terminal ((a): cd /volumes/yourvolume, (b): ls -a) or (3) use Path Finder or (4) iterate in the volume’s root folder from within Xojo): you’ll see there is a .trashes folder there, for that purpose.

I don’t say the trash folder of the logged-in user isn’t stored in an environnement variable, but it’s wrong to assume it’s only that.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [August 26, 2019, 1:46pm UTC](https://forum.xojo.com/t/no-trash/45454/9 "2019-08-26T13:46:11Z")

</div>

1. Empty your Trash

2. Mount a removable disk

3. Move a file on the removable disk to the Trash. Notice that the Trash is non-empty.

4. Eject the removable disk. Notice that the Trash is now empty.

5. Repeat step (2). Notice that the Trash is non-empty again.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [August 26, 2019, 1:53pm UTC](https://forum.xojo.com/t/no-trash/45454/10 "2019-08-26T13:53:14Z")

</div>

Also (if I am not mistaken) and SSD doesn’t have a trash folder

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [August 26, 2019, 3:07pm UTC](https://forum.xojo.com/t/no-trash/45454/11 "2019-08-26T15:07:10Z")

</div>

> [@451828:@Dave S](#):
>
> Also (if I am not mistaken) and SSD doesn’t have a trash folder

My external SSD certainly has a .Trashes directory. Forcing my way into it, I see there is a directory with my uid.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:22pm UTC](https://forum.xojo.com/t/no-trash/45454/12 "2020-10-29T19:22:58Z")

</div>


