Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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

Reply
43 replies

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

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.

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 $

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😉

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.

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.

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.

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

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.