|
|
#1 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
Deleting Files With Special Characters
Has anyone tried to delete a file with a special character--say the tm symbol--in it in Terminal?
Looks to me like it's impossible. I've tried the following and am open to further suggestions: 1) Drag folder into terminal--much multi-line weirdness results; 2) trying to type the symbol in Terminal (option-2)--same problem as above; 3) copy and paste from Finder--no dice; 4) copy and paste from 'ls' listing--no dice. Anybody have an idea what to do? Thanks, Andy |
|
|
|
|
|
#2 | |||||||||||||||||||
|
Moderator
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
|
baryonyx,
In Apple Doc "Mac OS X: About Trash, Deleting Locked Files" it says:
http://docs.info.apple.com/article.html?artnum=106272 Hope this helps. Cheers... |
|||||||||||||||||||
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
hmm, i wonder if it would help to set your character set encoding to unicode in the terminal prefs ->window settings... ( display )
i have few problems in bash with rm'ing a file named atm™ ; you mention a directory. are you using the proper form of rm? rm -r or rm -d ? Code:
$ touch atm $ # OZ: finder rename atm to atm(tm) $ ll atm™ # tab-completion here -rw------- 1 merv staff 0 Nov 11 09:24 atm™ $ rm !* $ rm atm™
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#4 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
Oh, holy heck, I wasn't clear at all what I was doing. You're supposed to read my mind, after all!
![]() Here's more of the story: I'm deleting this file from an OS 9 volume--I'm trying to rid myself of Netscape Communicater™ but for some reason I can't rename the folder in the Finder. It does not seem to matter that I gave myself permission(s) to do so. Rather than simply boot into OS 9 and trash this bad boy I was looking for an "easier" solution--har har! But this kind of stuff is challenging and interesting, so what the heck. Merv, I am using rm -r but I get nothing but hiccups because I can't type the filename correctly. The option-2 keyboard command seems to be a command in terminal analogous to 'ls,' which is unfortunate because that's also the keyboard command for (tm)™. How did you get Terminal to use this character? Andy Last edited by baryonyx; 11-11-2002 at 01:36 PM. |
|
|
|
|
|
#5 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
What about the tab key?
I just put an option-2 (tm) character in a file on my Desktop, and using the tab key to autocomplete the file name, had no trouble rm'ing the little bugger. -/- |
|
|
|
|
|
#6 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
Checked my window settings in Terminal and it turns out I already have character settings to Unicode. Tried Mac (western) and I get nothing at all when typing option-2. Copying the filename over completely ignores the ™ character, so I get the usual "no such file or directory" error when I do a rm -r.
Weird. Andy |
|
|
|
|
|
#7 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
mikey-san, I am unclear on your meaning. Are saying that using the Tab key will autocomplete a file or folder name? I tried it and it didn't seem to work...
Can you be specific about the mechanics of this? Thanks, Andy |
|
|
|
|
|
#8 | |||||||||||||||||||
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
hmm, i alluded to that in my post, but perhaps your missed it? what happens if you use the shell's tab key to auto-complete the dir name? % rm -r /Volume/volname/pathto/Netscape[tab] if you were to post some of your multi-line wierdness from before, it might be interesting, too.
__________________
On a clear disk, you can seek forever. |
|||||||||||||||||||
|
|
|
|
|
#9 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
Boy, that Tab-complete trick simply does not work for me. I even tried trashing my com.apple.Terminal.plist file and tried it and still no go.
Here's what happens when I drag the folder ito a Terminal window. I get the same thing when copying and pasting: Code:
[g4:~] dad% sudo rm -r /Volumes/R-2/Applications\ \(Mac\ OS\ 9\)/Netscape\ Communicator [g4:~] dad% sudo rm -r /Volumes/R-2/Applications\ \(Mac\ OS\ 9\)/Netscape\ \ FolderCommunicator Andy |
|
|
|
|
|
#10 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
try it from bash:
% bash $ rm -r /blah/blah/netscape[tab] $ exit or try this notation: % rm -r /blah/blah/Netscape\ Communicator\342\204\242\ Folder hmm, could your autocomplete be bork'd ? or could there be another 'special' char in there?
__________________
On a clear disk, you can seek forever. Last edited by mervTormel; 11-11-2002 at 02:29 PM. |
|
|
|
|
|
#11 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
Argghh. Neither works. I had tried using the \342\204\242\ code before and tcsh didn't like it. Bash didn't think much of it either.
As for my autocomplete, it seems to work fine for Darwin commands. But file names--that's a new one on me--simpy doesn't work. Quite a problem, isn't this? ![]() Andy |
|
|
|
|
|
#12 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
Report: I just came close. Seems like the ASCII non-lossy encoding will accept a copy and paste of the ™ character--sometimes. The problem with this encoding is that I can't seem to do anything else with it--lots of garbage characters depending on what key one presses. Gave me hope for a minute there.
Andy |
|
|
|
|
|
#13 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
try setting [x] ignore ownership on this volume in the finder get info window
or, make sure you have rw access to all the dirs in the hierarchy to the netscape dir then, maybe, you can rename the folder
__________________
On a clear disk, you can seek forever. |
|
|
|
|
|
#14 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
merv, you are a bloody genius. Worked like a charm. Thank you.
Andy |
|
|
|
|
|
#15 |
|
Prospect
Join Date: Aug 2002
Location: orange county,ca
Posts: 18
|
You can delete a file with strange characters (especially hidden characters) by it's inode number.
To find the inode number of a file, list the directory with the -i option: john# ls -i 2064227 test 2064227 is the inode (serial) number of the file 'test'. Use the find command to delete the file by it's inode number: find . -inum 2064227 -exec rm {} \;
__________________
Per Ardua Ad Alta |
|
|
|
|
|
#16 |
|
Major Leaguer
Join Date: Jan 2002
Location: Bethesda, MD
Posts: 300
|
Have you submitted this as a tip to Rob's main page? I think you ought to--very tasty little tidbit.
|
|
|
|
|
|
#17 |
|
Triple-A Player
Join Date: Feb 2003
Posts: 55
|
twin
similar thread:
http://forums.macosxhints.com/showth...3610#post53610 |
|
|
|
|
|
#18 | |||||||||||||||||||||||
|
Prospect
Join Date: Mar 2007
Posts: 12
|
I get an error when I try this, saying "File not found" with the file named "Ti?ng Viê?t.html"
I can't access this file any way possible. Any ideas how I can trash this file?
|
|||||||||||||||||||||||
|
|
|
|
|
#19 | |||||||||||||||||||||||
|
Prospect
Join Date: Mar 2007
Posts: 12
|
By the way, the file name I listed here isn't showing up properly on this page, the "Tieng Viet" has a couple accents over each of the e's. |
|||||||||||||||||||||||
|
|
|
|
|
#20 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
The solution to this specific problem is in this older thread: http://forums.macosxhints.com/showthread.php?t=62165
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
![]() |
|
|