Unofficial archive. This is a read-only, community-run archive of the Apple Support Community. It is not affiliated with or endorsed by Apple Inc.

Can't remove files from Trash

OK I have a new iMac, and I deleted some files from my iCloud Drive, but now I can't remove them from my trash folder.


I've tried everything I can possibly thing of... I've tried an "immediate delete", emptying the Trash in safe mode, I've changed permissions and removed the lock flag in terminal and tried to do an "rm -rf /folder", I've tried the terminal in recovery mode.


It says permission denied in the terminal, but when I try to empty the trash within the UI it tells me the files are in use. I have no idea what by, though... I've tried an lsof search on some of the files and it comes back with no response, suggesting that nothing is holding the files open. I've also tried shutting down every application I can think of.


My only thought is that because I deleted the files from my iCloud Drive it's somehow retaining an active link back to the original location, but again... safe mode didn't help.


It's driving me out of my mind, so any new suggestions greatly appreciated.

11 replies

Try removing them from iCloud Drive by signing in to its web interface, here: https://www.icloud.com/iclouddrive/


It has its own "Recently Deleted" folder.


Let us know if that works, if not I may have other ideas.

When you attempt to empty the Trash, and you get the "file in use" error message, you can use the lsof command in the Terminal to try to figure out what is causing this.


You mentioned in your post that you already tried this command, but did you try it this way?

  • lsof +D ~/.Trash


This command should list all open files inside the Trash directory, and in addition, show which process(es) is/are using them. You can also run that command with sudo to gain access to more details.


Then once you find the process, lsof will also provide that process' PID. You can then stop that process with the kill command.

Try signing out of iCloud, and signing back in again. It's the iCloud equivalent of "turning it off and on again". Upon signing out, you will be asked if you want to retain copies on the local Mac. I don't think it will matter which option you choose, so try it both ways.


Back up your Mac before doing anything, which just goes without saying.


That's all I can think of for now.

Hmm, it may be possible that the sync process between your Mac and the iCloud Drive has not fully completed yet.


I'm "scratching my head" to see if that will help me come up with anything else to offer. In the mean time, you can wait for someone else to reply, or go ahead, and contact Apple Support directly for further assistance with this issue.

Thanks


It's actually possible that the sync process between my computer and iCloud was interrupted.

I certainly did check. It was a big folder (about 5GB), that I copied to iCloud, and then tried to delete.


If that's an issue though, I would have expected a reboot or safe mode to solve it.


I just tried removing the files within the recovery console again, but I can't find my home folder. When I reboot into the recovery console and open the terminal I navigate to the "Users" folder but there is no home folder in there. I do not know why.


I wonder whether, if I can solve that problem, I can delete the files from within that recovery terminal?

OK so I've made progress.


It occurred to me that I might be able to restore it, so I moved it back out of the trash folder onto my Mac hard disk. That worked fine, but I still can't delete it from my hard drive. Same problem.


So I tried to move it to my external disk, and I got an error saying "the operation can't be completed because needs to be downloaded". This seemed a lot like the system still thinks it's downloading/syncing from iCloud.


So, I took your advice and logged out of iCloud on this Mac, but it STILL couldn't be deleted from my local hard disk. Permission denied or "in use" messages when I try.


There must be some way to disconnect the files on the disk from the sync process that has them locked.


I'm out of ideas, though. I'll try to talk to Apple support when I have more time.


Thanks. :)

Definitely tell us what they have to say.


Some progress is better than none. If the recalcitrant file is now out of the Trash and on your Desktop (or anywhere else) then try dragging it to iCloud Drive. Maybe that will reset its "in use" flag. Then, perhaps go about trying to delete it again.

That’s interesting.

it’s in the downloads folder which I think is sync’d. I suspect if I move it to a non-sync’d folder I’ll get the same message as when I try to move it to my external drive… but I’ll try.

I appreciate the recommendation, but I just ran that command as root and it did not return any results. :(



+1

This is a really good suggestion. Unfortunately the recently deleted folder in iCloud online was empty, despite me deleting these files from there. How odd. Thanks though.