Error code -50 when emptying trash

Discussion in 'OS X El Capitan (10.11)' started by newtestleper88, Jan 24, 2016.

  1. newtestleper88 macrumors newbie

    Joined:
    Jan 24, 2016
    #1
    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:

    [​IMG]

    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.
     
  2. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #2
    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?
     
  3. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #3
    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.
     
  4. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #4
    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.
     
  5. damienzm macrumors newbie

    Joined:
    Jan 25, 2016
    #5
    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
     
  6. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #6
    Same error when I try this.

    When I try this, terminal gives me an "Invalid argument" error, and the file remains.
     
  7. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #7
    ?
    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/*
     
  8. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #8
    Nope, I tried both versions. Same result.
     

    Attached Files:

  9. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #9
    The problem is clearly the garbled file in */Rescued Items. Open Disk Utility and perform a First Aid operation on your “DeLorean” volume.
     
  10. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #10
    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.
     
  11. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #11
    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.
     
  12. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #12
    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.
     
  13. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #13
  14. newtestleper88, Jan 25, 2016
    Last edited: Jan 25, 2016

    newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #14
    Didn't work either :/
    It's saying "[Errno 13] Permission denied" although i do have read/write permission for the file.
     
  15. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #15
    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...
     
  16. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #16
    Using sudo and executing a command as root directly are indistinguishable.

    @newtestleper88: How old was that backup? Was it pre-El Capitan?
     
  17. 556fmjoe macrumors 65816

    Joined:
    Apr 19, 2014
    #17
    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.
     
  18. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #18
    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.
     
  19. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #19
    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
    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]
     
  20. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #20
    Have you typed “y” (without quotation marks) and pressed enter after the last command? It asks for your confirmation before it removes the file.
     
  21. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #21
    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
     
  22. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #22
    One final attempt: change the command into:
    Code:
    find . -inum 17617761 -delete
     
  23. newtestleper88 thread starter macrumors newbie

    Joined:
    Jan 24, 2016
    #23
    nope, same message.
    Code:
    find: -delete: unlink(./␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀ᘀȀࠀ瀀氀漀琀⸀瀀礀挀Ȁ؀␀␀伧Ȁ㟿㟆㟿㟆퇏⯇哝⯇␀): Invalid argument
     
  24. damienzm macrumors newbie

    Joined:
    Jan 25, 2016
    #24
    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..
     
  25. KALLT, Jan 26, 2016
    Last edited: Jan 26, 2016

    KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #25
    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
     

Share This Page