bidiu

Q: Cannot delete/rename/move a file from Windows with a special character

Not long ago, I used a portable hard drive to switch some data between my PC and MacBook (Running OS X 10.11.1).

Unfortunately, I was stupid to make an alias for my hard drive on my Mac's desktop by accident, right after my portable hard drive was mounted.

The question is that I can't even delete/rename/move it. Restarting system doesn't work, and commands (sudo rm/mv ..) from the Terminal doesn't work either.

 

When I was trying to remove/move the alias file, I got what's like this, "The operation can’t be completed because an unexpected error occurred (error code -50)."

And when trying to rename it with filename "a", I got what's like this, "Try using a name with fewer characters, or with no punctuation marks.''

 

I think this probably has to do with the hard drive's name, which has a weird character "NUL", one character. Maybe this character is legal in Windows, but illegal in OS X? Or maybe there're some differences between Windows and Mac interpreting a filename?

 

Any help, thanks!

MacBook Pro with Retina display, OS X El Capitan (10.11.1)

Posted on Jan 5, 2016 11:19 PM

Close

Q: Cannot delete/rename/move a file from Windows with a special character

  • All replies
  • Helpful answers

first Previous Page 3 of 3
  • by VikingOSX,

    VikingOSX VikingOSX Feb 12, 2016 6:27 PM in response to bidiu
    Level 7 (20,591 points)
    Mac OS X
    Feb 12, 2016 6:27 PM in response to bidiu

    I can confirm that the following sequence worked by booting from a Yosemite USB stick, and using Terminal from Utilities. Another strong reason to have a bootable USB stick with a previous OS X release on it. My file was not in a DMG. What a PITA.

    $ rm -f "Xiumi's Backup"$'\342\220\200'" Alias"

  • by ptfr,

    ptfr ptfr Feb 26, 2016 3:36 PM in response to VikingOSX
    Level 1 (0 points)
    Feb 26, 2016 3:36 PM in response to VikingOSX

    Hi all. 

     

    I'm kind of new to this string but have followed with interest as I have virtually the sam problem.  I have a backup file with "In␀rementa" in the name.  By booting into Yosemite I have removed this ice from all my drives except the main Mac HD drive.  Here, it is in the Trash, and when  I boot to another drive, I cannot see the Trash folder on the Mac HD drive.  I have tried the Go To ,Trashes/501 solution but it does not work.

     

    How can I see the Trash folder on one drive when booting from another?

     

    Thanks in advance

     

    PTFR

  • by VikingOSX,

    VikingOSX VikingOSX Feb 26, 2016 3:53 PM in response to ptfr
    Level 7 (20,591 points)
    Mac OS X
    Feb 26, 2016 3:53 PM in response to ptfr

    The file that I had with an embedded null in the filename resisted every means to move it to the Trash, or remove it, until I performed the steps in my last post. Trust me when I tell you that even the Finder would not move it anywhere on, or off of the main drive, from its current location.

  • by To_Mi,

    To_Mi To_Mi Feb 26, 2016 4:13 PM in response to ptfr
    Level 2 (351 points)
    iLife
    Feb 26, 2016 4:13 PM in response to ptfr

    Other possible location for trashed files is, /Volumes/volume-name/Users/user-name/.Trash, with the underlined parts replaced by your owns.

    > ,Trashes/501

    Please note that, ".Trashes" and ".Trash" start with a period, not a comma, which is a traditional way to hide files/directories from normal operation on UNIX system.

  • by rccharles,

    rccharles rccharles Feb 26, 2016 4:31 PM in response to VikingOSX
    Level 6 (8,459 points)
    Classic Mac OS
    Feb 26, 2016 4:31 PM in response to VikingOSX

    If it's there...

     

     

    There are more trash folders.

     

    When booted from the start up disk, it would be in /Users/-your-user-name-/.Trash/

    # example.  when booted as the startup disk.
    mac $ pwd
    /Users/mac
    mac $ ls -lad .T*
    drwx------  30 mac  staff  1.0K Feb 24 21:28 .Trash/
    
    
    

     

     

    For things deleted when access as an external drive. Which is you example, but you typed the wrong name.

     

    mac $ sudo bash
    Password:
    
    
    root # pwd
    /Volumes/Backup - Mac Mini/.Trashes/501
    root # ls -l
    total 24
    -rw-r--r--@ 1 mac   staff  6148 Feb 26 19:18 .DS_Store
    -rw-r--r--  1 root  wheel  2141 Jan 30 14:51 mac
    root # exit
    exit
    mac $
    
    
    

     

    Just  because your not booted from the disk as the started disk, it will not  be moved. The path will be different.

     

    mac $ pwd
    /Volumes/Backup - Mac Mini/Users/mac/.Trash
    mac $ ls -l pho*
    -rw-r--r--@ 1 mac  staff    51K Dec 13 15:06 photo 1.PNG
    -rw-r--r--@ 1 mac  staff   101K Dec 13 15:06 photo 2.PNG
    -rw-r--r--@ 1 mac  staff    61K Dec 13 15:06 photo 3.PNG
    -rw-r--r--@ 1 mac  staff   125K Dec 13 15:06 photo 4.PNG
    mac $
    
    
    

     

    The trash is a hidden folder to see do from the terminal /Applications/Utilities/Termainal.

     

    # Show hidden files & folders in finder
    defaults write com.apple.finder AppleShowAllFiles TRUE   ;killall Finder
    # Normal display.  Hide hidden files & folders in finder
    defaults write com.apple.finder AppleShowAllFiles FALSE  ;killall Finder
    mac $
    
    
    
  • by ptfr,

    ptfr ptfr Feb 28, 2016 11:20 PM in response to rccharles
    Level 1 (0 points)
    Feb 28, 2016 11:20 PM in response to rccharles

    Thanks rccharles

     

    The instructions for revealing hidden files through terminal worked.  I was then able to boot from a Yosemite drive, see the Trash folder on my El Capitan drive,  and delete the "In␀rementa" file - FINALLY!!

     

    Thanks for all your help

  • by rccharles,

    rccharles rccharles Feb 29, 2016 12:28 PM in response to ptfr
    Level 6 (8,459 points)
    Classic Mac OS
    Feb 29, 2016 12:28 PM in response to ptfr

    Way to go!

     

    R

  • by bidiu,

    bidiu bidiu Mar 12, 2016 6:25 PM in response to bidiu
    Level 1 (1 points)
    Mar 12, 2016 6:25 PM in response to bidiu

    Hi,

     

    Sorry for the delay.

    I've been busy applying for my grad school and a short-term intern recently, and all those adaptation stuff.

    Since I do not have the equipments to do a TDM, I will try to boot from a Yosemite USB stick.

     

    Downloading Yosemite is going to take a while considering my bandwidth.

    I will update my proceeding onto this thread as soon as I try out this solution.

     

    Again, thank everyone in this thread, really appreciate you guys help

  • by GittinWorse,

    GittinWorse GittinWorse Mar 28, 2016 8:12 AM in response to bidiu
    Level 1 (8 points)
    Mac OS X
    Mar 28, 2016 8:12 AM in response to bidiu

    This solution only works on older machines that can boot in Yosemite, for those of us who made the mistake of buying another mac, the solution is to reformat the disk, use my original disk image and a partial restore from time machine.

     

    UGH, hours of work to delete a file that could have been deleted in seconds using any previous MAC operating system.

     

    PC's are looking better with each new version of OSX.

  • by VikingOSX,

    VikingOSX VikingOSX Mar 28, 2016 9:22 AM in response to GittinWorse
    Level 7 (20,591 points)
    Mac OS X
    Mar 28, 2016 9:22 AM in response to GittinWorse

    It would seem to me that one can either boot from Recovery on an El Capitan machine, drop into the Terminal, and follow the steps presented here to remove the file, or download El Capitan from the App Store, build a bootable USB stick from it, and once booted, use its Terminal solution to remove the file in question. This solution should not be limited to Yosemite.

  • by GittinWorse,

    GittinWorse GittinWorse Mar 28, 2016 7:16 PM in response to VikingOSX
    Level 1 (8 points)
    Mac OS X
    Mar 28, 2016 7:16 PM in response to VikingOSX

    Yes, it would seem like that would should work.

     

    Too bad it doesn't.

     

    I've got 4 different ways to boot into El Capitan, including a USB stick. Doesn't how you boot into it, if your in El Capitan you won't be able to delete these files in Terminal or the GUI.

     

    Word of advice. If you don't have a disk image and a current time capsule or other backup, you'll be stuck re-installing all your software since the only solution to this in El Capitan is reformatting your drive or booting into another operating system ( if available).

     

    I tried removing the user, but the system couldn't remove the user with the file in the users trash.

  • by GittinWorse,

    GittinWorse GittinWorse May 15, 2016 9:05 AM in response to GittinWorse
    Level 1 (8 points)
    Mac OS X
    May 15, 2016 9:05 AM in response to GittinWorse

    Just a quick aside note, since the trash is user based I thought I would just create a new user account and delete the old user account. Ya can't do that either, it won't let you delete a user account with the bad filenames in the users trash.

  • by Dr.MORO,

    Dr.MORO Dr.MORO Jun 13, 2016 12:18 PM in response to To_Mi
    Level 1 (9 points)
    Mac OS X
    Jun 13, 2016 12:18 PM in response to To_Mi

    HI! Having the same problem here, trying to avoid the full-restore from Time Machine backup.

    Will try this soon. Thanks, for now.

  • by Dr.MORO,

    Dr.MORO Dr.MORO Jun 17, 2016 1:59 PM in response to Dr.MORO
    Level 1 (9 points)
    Mac OS X
    Jun 17, 2016 1:59 PM in response to Dr.MORO

    Yahoo!!! It works!!!

     

    Basically did as learnt from here, after learning a bit more on how to use the basic Terminal commands.

     

    BTW, my "How-to" is posted in this thread.

     

    All my problematic "Invalid argument" files are finally gone! Yippee!

     

    Hope this works & helps others.

     

    Thank you so much!

     

    ~ Dr.MORO

first Previous Page 3 of 3