Undeletable file


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Undeletable file
# 1  
Old 07-18-2019
Undeletable file

Greetings,

I'm trying to delete a file with a weird name from within Terminal on a Mac.
It's a very old file (1992) with null characters in the name: ␀␀Word Finder® Plus™.

Here are some examples of what I've tried:

Code:
12FX009:5 dpontius$ ls
␀␀Word Finder® Plus™
12FX009:5 dpontius$ rm "␀␀Word Finder® Plus™"
rm: ␀␀Word Finder® Plus™: Invalid argument

12FX009:5 dpontius$ rm -r
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file
12FX009:5 dpontius$ ls
␀␀Word Finder® Plus™

12FX009:4 dpontius$ rm -r 5
rm: 5/␀␀Word Finder® Plus™: Invalid argument
rm: 5: Directory not empty

12FX009:5 dpontius$ mv ␀␀Word Finder® Plus testName
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

12FX009:5 dpontius$ mv "␀␀Word Finder® Plus™" testName
mv: rename ␀␀Word Finder® Plus™ to testName: Invalid argument

Help appreciated greatly!

cheers,
dp

Last edited by Scrutinizer; 07-18-2019 at 03:21 PM.. Reason: code tags correction
# 2  
Old 07-18-2019
Hi...

On inspection the two NULL characters that you have shown us are unicode when hexdumped:
Code:
Last login: Thu Jul 18 16:34:33 on console
AMIGA:amiga~> hexdump -C <<< "␀␀Word Finder® Plus™"
00000000  e2 90 80 e2 90 80 57 6f  72 64 20 46 69 6e 64 65  |......Word Finde|
00000010  72 c2 ae 20 50 6c 75 73  e2 84 a2 0a              |r.. Plus....|
0000001c
AMIGA:amiga~> _

Have you tried the GUI dragging the file to the 'Trash' from within Finder, then clearing the Trash?
How about using single quotes instead of double?
How about mv '␀␀Word Finder® Plus™' /tmp/testname in single quotes and let the system remove it during reboot.
Are all the relevant permissions set for YOU to read and write from and to the file?
Remember any of these could cause problems so be very aware.
And finally are you absolutely sure you have the FULL filename and not missing, say, trailing spaces(s)?
That is all I can think of so far...
# 3  
Old 07-18-2019
Try with wildcards, -i prompts for each match, so you can say yes only to the desired match:
Code:
rm -i ./*Word*

These 2 Users Gave Thanks to MadeInGermany For This Post:
# 4  
Old 07-18-2019
FWIW, I would solve this by doing exactly what MadeInGermany suggests in post#3 (unless there are so many files in the directory that you would be there all day to do it).
# 5  
Old 07-18-2019
Thanks so much for the prompt ideas. Unfortunately, none have succeeded. I've repeated tried to delete by dragging and always get "The operation can't be completed because an unexpected error occurred (error code -50)." The file is in a folder by itself that I've tried to delete the entire folder, but that won't work either.

Latest attempts:

Single quotes
Code:
12FX009:5 dpontius$ rm '␀␀Word Finder® Plus™'
rm: ␀␀Word Finder® Plus™: Invalid argument

rename with testname in tmp folder:
12FX009:5 dpontius$ mv '␀␀Word Finder® Plus™' /tmp/testname 
mv: rename ␀␀Word Finder® Plus™ to /tmp/testname: Invalid argument

Permissions look fine:
12FX009:5 dpontius$ ls -l
total 48
-rwxr-xr-x@ 1 dpontius  staff  0 Feb 27  1992 ␀␀Word Finder® Plus™

Delete with wildcards:
12FX009:5 dpontius$ rm -i ./*Word*
remove ./␀␀Word Finder® Plus™? y
rm: ./␀␀Word Finder® Plus™: Invalid argument

Throughout, the little bugger is still there. No trailing spaces present. I find it interesting to see the unicode characters wisecracker revealed. Does anyone know how to use that information to identify a file to delete?

Much obliged.

cheers,
dp
# 6  
Old 07-18-2019
Oh, it's in a folder by itself. Okay then, how about (from the directory above):

Code:
# rm -rf <directory name>

That is use -r (for recursive) and -f (for force)

What does that do using the nuclear options?

Last edited by hicksd8; 07-18-2019 at 04:18 PM..
# 7  
Old 07-18-2019
Thanks, but the zombie remains:

Code:
12FX009:4 dpontius$ ls
5
12FX009:4 dpontius$ # rm -rf 5
12FX009:4 dpontius$ ls 5
␀␀Word Finder® Plus™


Last edited by dpontius; 07-18-2019 at 04:36 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

4. UNIX for Dummies Questions & Answers

Files.... undeletable.

I've some files created by a script. For some reason last time the script run was interrupted for an error and the files produced by the script are undeletable. i've tryed as root with command 'rm' and even if i got no error in command execution the files are still there. These are the... (9 Replies)
Discussion started by: mirrorx
9 Replies

5. UNIX for Dummies Questions & Answers

undeletable file

when i try to ls -lrt the directory, the "undeletable" file is listed. but when i try to ls -lrt *exe, the "undeletable" file is not listed. this "undeletable" is the file that i want to delete from the directory. but when i try to delete/rename/copy.... it, it show that "No such file or... (10 Replies)
Discussion started by: chxxangie
10 Replies
Login or Register to Ask a Question