Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtestleper88

macrumors newbie
Original poster
Jan 24, 2016
15
0
I had an old time machine backup on an external HDD that I stupidly tried to delete by dragging it to the trash. Now I have a file in my trash that looks like this:



which I cannot get rid of. Anytime I try to empty the trash, it gives me error code -50. I've searched online for this and attempted various methods to fix it with no success. Also, anytime I try to drag it out of the trash, it creates another copy of the file wherever I dragged it out to, but the original stays in the trash, and I'm unable to move the new one back to the trash (error code -50 again). So now I'm left with one of these mysterious files in the trash and another one on my desktop, neither of which I can get rid of.



I have a 2013 MacBook Air on El Capitan.
 
Can you rename either the file on your desktop, or the one in the trash?
Just click on the file to select it, then press enter to select the name. type a few characters, maybe something like the word junk. Then press enter again, or press the tab key to leave the name edit mode.
I suspect you won't be able to do that while the file is in the trash, but it may work to rename it while on the desktop.
You may not be able to do anything to the file, but if the name does change, drag back to the trash, then try to empty the trash again.

Try this: Open the trash. Right-click the file. Choose "Delete Immediately..." from that right-click menu.
Try the same trick on the file on your desktop.
Can you remove either of those files?
 
Can you rename either the file on your desktop, or the one in the trash?
Just click on the file to select it, then press enter to select the name. type a few characters, maybe something like the word junk. Then press enter again, or press the tab key to leave the name edit mode.
I suspect you won't be able to do that while the file is in the trash, but it may work to rename it while on the desktop.
You may not be able to do anything to the file, but if the name does change, drag back to the trash, then try to empty the trash again.

Try this: Open the trash. Right-click the file. Choose "Delete Immediately..." from that right-click menu.
Try the same trick on the file on your desktop.
Can you remove either of those files?

I forgot to mention that whenever I try to rename the file (either the one in the trash or desktop) it gives me a message that says "Try using a name with fewer characters, or with no punctuation marks." no matter what name I use.

Delete immediately also just gave me the same -50 error code.
 
Looks like you should try a force delete from the trash.

Did you try the file on the desktop? Select that file, then File menu, hold your Option key, and choose Delete Immediately...

If none of that works, then try a force empty trash through the terminal.
Code:
sudo rm -rf ~/.Trash /Volumes/*/.Trashes

General Caveat: be cautious if you type that command manually. Better to copy from here and paste into the terminal window.
 
I've been working on this for hours, it started after the latest Capitan download.. some issue with my Time Machine backup, I tried to copy the file to my HD and created a dupe in the trash. I erased the Backup drive and got rid of that one, but the artifact remains. I've tried all all of the Terminal suggestions, Rebooting in Safe Mode, etc.. I think this is a bug from the latest OS, and I should just let go... but
 
Looks like you should try a force delete from the trash.

Did you try the file on the desktop? Select that file, then File menu, hold your Option key, and choose Delete Immediately...

Same error when I try this.

If none of that works, then try a force empty trash through the terminal.
Code:
sudo rm -rf ~/.Trash /Volumes/*/.Trashes

General Caveat: be cautious if you type that command manually. Better to copy from here and paste into the terminal window.

When I try this, terminal gives me an "Invalid argument" error, and the file remains.
 
?
If you did a copy/paste, then the line could be incorrect... not sure how, but...
Try this (again, DON'T type it yourself, just copy and paste into your terminal!)
Code:
sudo rm -rf ~/.Trash/*
 
?
If you did a copy/paste, then the line could be incorrect... not sure how, but...
Try this (again, DON'T type it yourself, just copy and paste into your terminal!)
Code:
sudo rm -rf ~/.Trash/*
Nope, I tried both versions. Same result.
 

Attachments

  • Screen Shot 2016-01-25 at 11.13.13 AM.png
    Screen Shot 2016-01-25 at 11.13.13 AM.png
    105.8 KB · Views: 470
The problem is clearly the garbled file in */Rescued Items. Open Disk Utility and perform a First Aid operation on your “DeLorean” volume.
First aid done with no errors; still unable to empty trash. not to mention the same file that still exists on my desktop which i'm unable to move, delete, or rename.
 
First aid done with no errors; still unable to empty trash. not to mention the same file that still exists on my desktop which i'm unable to move, delete, or rename.

Then perhaps you should do a First Aid operation on your main drive too. You may have to reboot into Recovery by holding command-R at startup. I don’t know what else to suggest, but if your file system cannot reference this file, then it is not able to delete it. A disk format would then be the only solution.
 
Then perhaps you should do a First Aid operation on your main drive too. You may have to reboot into Recovery by holding command-R at startup. I don’t know what else to suggest, but if your file system cannot reference this file, then it is not able to delete it. A disk format would then be the only solution.
unfortunately that looks to be my only option. i've already done first aid in recovery mode on both drives, not to mention verifying and repairing disk permissions.
 
Last edited:
Permissions/ownership may not be valid on a corrupted file like that.

Did you also try the xattr command with a sudo?
Not sure if that will make a difference, but that takes you to superuser level.

Or, you could enable your root account, then log in to your root user, which may let you remove those corrupted files.

You are approaching the point where your best next step may be what KALLT suggested in post #11 - if you really want to remove that stubborn file. (basically, removing everything around it :D )
Maybe there's another step or two before that, but...
 
Permissions/ownership may not be valid on a corrupted file like that.

Did you also try the xattr command with a sudo?
Not sure if that will make a difference, but that takes you to superuser level.

Or, you could enable your root account, then log in to your root user, which may let you remove those corrupted files.

Using sudo and executing a command as root directly are indistinguishable.

@newtestleper88: How old was that backup? Was it pre-El Capitan?
 
You may have to delete it by its inode number. First you need to find it

Code:
ls -i ~/.Trash

This should print the contents of the ~/.Trash directory along with their inode numbers.

Next step is to delete the inode like so

Code:
find . -inum 123456 -exec rm -i {} \;

Replace "123456" with whatever the corresponding inode number is for your garbled file. I'm not on OS X so I can't verify that this will work, but this is how it's done in most Unix systems. Someone should correct me if it doesn't apply.
 
You may have to delete it by its inode number. First you need to find it

Code:
ls -i ~/.Trash

This should print the contents of the ~/.Trash directory along with their inode numbers.

Next step is to delete the inode like so

Code:
find . -inum 123456 -exec rm -i {} \;

Replace "123456" with whatever the corresponding inode number is for your garbled file. I'm not on OS X so I can't verify that this will work, but this is how it's done in most Unix systems. Someone should correct me if it doesn't apply.

It is worth a try. In this case the OP would have to navigate to the folder where the garbled files are located (the “Rescued Files” folder). Something like this:
Code:
cd "/Volumes/DeLorean/.Trashes/501/dumb/Gabriel’s iMac/2013-06-21-001338/Macintosh HD/Rescued Items"

Then just what you said:
Code:
ls -i

This should return the inode numbers of the files.
 
Permissions/ownership may not be valid on a corrupted file like that.

Did you also try the xattr command with a sudo?
Not sure if that will make a difference, but that takes you to superuser level.
Tried with sudo, tells me this
Code:
Gabriels-MacBook-Air:Rescued Items gabrielpinto$ sudo xattr -d com.apple.FinderInfo /Users/gabrielpinto/Desktop/␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀
xattr: /Users/gabrielpinto/Desktop/␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀: No such xattr: com.apple.FinderInfo
It is worth a try. In this case the OP would have to navigate to the folder where the garbled files are located (the “Rescued Files” folder). Something like this:
Code:
cd "/Volumes/DeLorean/.Trashes/501/dumb/Gabriel’s iMac/2013-06-21-001338/Macintosh HD/Rescued Items"

Then just what you said:
Code:
ls -i

This should return the inode numbers of the files.

File is still there after this. Here's the output.
Code:
17617761 ␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀ?瀀氀漀琀?瀀礀挀Ȁ?␀␀伧Ȁ㟿㟆㟿㟆퇏?哝?␀
54816050 ␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀ?瀀氀漀琀?瀀礀挀Ȁ?␀␀伧Ȁ㟿㟆㟿㟆퇏?哝?␀ 2
Gabriels-MacBook-Air:Rescued Items gabrielpinto$ find . -inum 17617761 -exec rm -i {} \;
remove ./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀?

Thanks for all the help everyone; I really appreciate it. It looks like reformatting is going to be my only option unless there is some other solution.[/QUOTE]
 
File is still there after this. Here's the output.
Code:
17617761 ␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀ?瀀氀漀琀?瀀礀挀Ȁ?␀␀伧Ȁ㟿㟆㟿㟆퇏?哝?␀
54816050 ␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀ?瀀氀漀琀?瀀礀挀Ȁ?␀␀伧Ȁ㟿㟆㟿㟆퇏?哝?␀ 2
Gabriels-MacBook-Air:Rescued Items gabrielpinto$ find . -inum 17617761 -exec rm -i {} \;
remove ./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀?

Thanks for all the help everyone; I really appreciate it. It looks like reformatting is going to be my only option unless there is some other solution.

Have you typed “y” (without quotation marks) and pressed enter after the last command? It asks for your confirmation before it removes the file.
 
Have you typed “y” (without quotation marks) and pressed enter after the last command? It asks for your confirmation before it removes the file.
whoops, didn't realize i was supposed to type "y." all i did was press enter. either way, that did not seems to work either.
Code:
Gabriels-MacBook-Air:Rescued Items gabrielpinto$ find . -inum 17617761 -exec rm -i {} \;
remove ./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀? y
rm: ./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀: Invalid argument
 
whoops, didn't realize i was supposed to type "y." all i did was press enter. either way, that did not seems to work either.
Code:
Gabriels-MacBook-Air:Rescued Items gabrielpinto$ find . -inum 17617761 -exec rm -i {} \;
remove ./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀? y
rm: ./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀: Invalid argument

One final attempt: change the command into:
Code:
find . -inum 17617761 -delete
 
One final attempt: change the command into:
Code:
find . -inum 17617761 -delete
nope, same message.
Code:
find: -delete: unlink(./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀): Invalid argument
 
I tried everything, spent hours. Really annoying that Apple took away the "force empty" function, the others are clearly something else.

I found one suggestion on the internet that worked: restore to the most recent backup from TM.. even though that backup was from a period when the issue was occurring, the restored version no longer had the undeletable folder in the trash.

If it happens again, I know what to do..
 
I tried everything, spent hours. Really annoying that Apple took away the "force empty" function, the others are clearly something else.

That function still exists, it just isn’t exposed in Finder’s GUI. It is not materially different from the rm function, however, except that it overwrites data as well.

I guess it does not hurt to try:
Code:
find . -inum 17617761 -exec srm -is {} \;

Alternatively (confirm with “y” and enter again):
Code:
cd "/Volumes/DeLorean/.Trashes/501/dumb/Gabriel’s iMac/2013-06-21-001338/Macintosh HD" && srm -ris Rescued\ Items
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.