2

I have a strange issue with deleting items from the Trash. It appears that there are infinite nested directories which I cannot seem to remove. If I try to "empty" the trash I get an error which reads "The operation can’t be completed because the item is in use.". I tried using Terminal to cd into .Trash and the files are not listed, but I tried rm -rf * anyway, but to no avail...

It goes and goes and goes...

The nested directories go on forever apparently (it shows 1-36 there in the image, but if I use the arrow to expand the last one then another, and another, and another shows up)... Does anyone have a clue how I can remove these from the Trash? Thanks.

EDIT: After waiting some time I now also get another error "You can’t open the Trash because it’s being emptied.". Oddball behavior here.

5 Answers 5

0

There is an app you can find called Trash It and that usually sorts this type of thing out:

What is Trash It?

This little Applescript-based App force-empties your Apple trash can, ridding it of files and folders that refuse to be deleted. It also supports Drag and Drop. If you have stuck files or folders in the Trash with permissions set incorrectly, locked items, want to delete a stubborn file(s) or folder(s) on your desktop or elsewhere, or delete items from other partitions, give Trash It! a try.

I am not involved in any way with "Trash It" : standard disclaimer apart from having used it!

4
  • Thanks, that seems to have resolved the issue - It would be nice to know what the app is actually doing to clear out the .Trash; according to the article linked in the other answer by ProGrammer it's similar, but no way to know since the problem is resolved for now.
    – Sam Hagar
    Feb 11, 2018 at 7:36
  • When I had the issue, found a response that listed several commands to be run in the terminal window as root - where I tend to take care... and worry about typos etc and then I saw Trash It - basically it does all the fancy removing and replacing of the trash folder with other permission checks from what i understand so I went with that...
    – Solar Mike
    Feb 11, 2018 at 7:42
  • 1
    Yeah it was quick and easy... I had to use the second option "Really Stuck", and boom the folders were gone. Thanks again!
    – Sam Hagar
    Feb 11, 2018 at 7:43
  • 2
    It would be good if the downvoters could give an explanation....
    – Solar Mike
    Feb 11, 2018 at 14:34
2

It is certainly interesting to see an infinite folder structure in the trash so naturally, the typical deletion process would take infinite time. Something went horribly wrong somewhere.

What can you try?
Close all programs (reboot if necessary to interrupt the current deletion process) and try Running First Aid on your boot volume. Be sure to disconnect any attached drives such as TimeMachine backups or network shares to eliminate them from the equation.

You mentioned having tried the sudo rm -rf ~/.Trash command to no avail, but how about sudo rm -rf /Volumes/*/.Trashes? The full article is here in case you are looking for a little background information. Your macOS system will rebuild the .Trashes folder next time it needs it.

As far as the "You can’t open the Trash because it’s being emptied." message is concerned, this is usually fixed through a Finder restart or better yet, system restart.

Let me know if that makes sense and how it works out for you.

6
  • 1
    I couldn't try your solution since I tried Solar Mike's suggestion first (which seemed to work). According to the article you linked the app mentioned in the other answer supposedly runs similar commands, but no way to know until it happens again... thanks though for the nice explanation!
    – Sam Hagar
    Feb 11, 2018 at 7:37
  • @SamHagar : I still suggest you to follow the 1st recommandation of this answer, because to create such a directory structure means your filesystem is corrupted at its structure level. You fixed the symptoms, not the cause.
    – dan
    Feb 11, 2018 at 14:20
  • @danielAzuelos when I had a similar issue I ran all the tests via disk utility and all the file system checks came back as correct - however the trash still had recursive directories so if all tested correct then what gives?
    – Solar Mike
    Feb 11, 2018 at 14:30
  • @danielAzuelos removed your comments but can't answer...Thanks.
    – Solar Mike
    Feb 11, 2018 at 14:46
  • @Solarmike : then your problem was just a Finder one which is much less risky because the Finder is just a graphical interface to manage the filesystem. In such a case, the 3rd part of this answer (Finder restart) is the simplest fix.
    – dan
    Feb 11, 2018 at 16:05
1

I was able to fix this by moving the top level of the recursive folder to the desktop (anywhere outside of the trash, really), then select the top level folder, then press option-command-delete to re-delete it without putting it back in the trash.

0

I ran into this problem the other day and also couldn't get any third party apps or terminal to trash the trash.

My solution is

  1. Move folder from trash to desktop
  2. Open terminal
  3. Type following command rm -rf ~/Desktop/folder-name/
  4. Enter and this will remove the folder.

Is this the answer to why it happened, no it is not. But hopefully it will help the next person who runs into this issue without using any third party apps.

0

I ran into this problem a couple of times and I tried lots of different 'fixes' but nothig worked until I did these following steps:

  1. Open Trash
  2. Open one of the nested folders
  3. Open another nested folder inside the previously opened one
  4. Move the current nested folder into the first folder
  5. Empty Trash

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .