How to force the Mac to delete the trash which contains deeply nested locked folders

deletingfinderpermissiontrash

I have hundreds of gigabytes of files that I manually (tried) to delete from an external hard drive. However I can't empty my trash, and no space has freed up on the drive.

When I try to empty my trash, I get an error saying that I can't, because some of the files are locked, or in use or I don't have permission. The Macos popup tells me I should manually locate and change the permissions of the offending file.

Here's the problem, there are 10s of thousands of files, so that is not realistic.

What hasn't worked:
Putting sudo rm -R into my command line and dragging the offensive trash into my terminal.

Selecting trash files in question, clicking "get info" and unlocking them still doesn't let me right click and delete immediately.

Restarting my computer hasn't helped either. When I reconnect the drive, I still have no space freed and the junk files are still living in my trash folder… unable to be removed.

As things are now, I've exhausted all available solutions to reclaim this space on my drive.

My setup:
Macbook air, up to date with Big Sur 11.4

Best Answer

Let's assume the name of the drive is /Volumes/External/ for the sake of discussion.

Go into Terminal and type:

sudo find "/Volumes/External/.Trashes/$EUID" -depth -mindepth 1 -print

That should show you all of the files in your Trash on the external drive.

If you want to try deleting them, try this:

sudo find "/Volumes/External/.Trashes/$EUID" -depth -mindepth 1 -print -delete

Note: Be careful. Mistyping this command can do serious damage since you are deleting files using sudo. The -print command by itself is safe. Once you add -delete then you are deleting files.

Use at your own risk.