Undeletable file


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Undeletable file
# 1  
Old 07-19-2019
Tried the last suggestion by hicksd8, find and delete, no luck.

Also, I moved the thread to the OS-X forum as that seems more appropriate. I'd intended it to be there from the start.

cheers,
dp
# 2  
Old 07-19-2019
If find doesn't work, no other user-mode application is going to work. The filename is invalid and the kernel refuses to touch it. You need a disk editor.
# 3  
Old 07-19-2019
MadeInGermany and hicksd, thank you very much. As advised, I will proceed with extreme caution.

If there are any MacOS experts listening, I'd appreciate your input.

cheers,
dp
# 4  
Old 07-19-2019
This is also my last attempt.
YOU USE THIS AT YOUR OWN RISK!
I discovered that Windows CP 1252 certainly does have these characters as single bytes in it.
Code:
#!/bin/sh

# Windows 1252 code page 8 bit values, (with UTF-8 unicode values shown)...

NULLS=$'\x80\x80'
REG=$'\xAE'
TM=$'\x99'
FILENAME="${NULLS}"'Word Finder'"${REG}"' Plus'"${TM}"

# Should be 20 characters long.
echo "${#FILENAME}"

echo "${FILENAME}"

hexdump -C <<< "${FILENAME}"

##### !!!YOU USE BELOW AT YOUR OWN RISK!!! #####
# rm -f "${FILENAME}"

Example printout:
Code:
Last login: Fri Jul 19 17:52:27 on ttys000
AMIGA:amiga~> cd Desktop/Code/Shell
AMIGA:amiga~/Desktop/Code/Shell> ./Invalid_Filename.sh
20
??Word Finder? Plus?
00000000  80 80 57 6f 72 64 20 46  69 6e 64 65 72 ae 20 50  |..Word Finder. P|
00000010  6c 75 73 99 0a                                    |lus..|
00000015
AMIGA:amiga~/Desktop/Code/Shell> _

REMEMBER! You are messing with a file that is NOT native to OSX 10.11.x.
Save/backup everything you need before removing the final '#' on the last line and then executing this code.
WWW.UNIX.COM and its helpers in this thread do NOT hold any responsibility for anything that goes awry.
# 5  
Old 07-19-2019
IMHO a glob match returns even unprintable characters.
So the last proposal does not improve anything.

And the clri command (didn't know it yet), will cause extra harm.
It is useless to clear the inode of the file, because an inode contains the data block structure and all meta information BUT THE FILENAME.
The filename and the pointer to the inode is stored in the directory.
The directory is another inode. To have an effect you must clear the directory inode.
I expect less damage with
Code:
unlink <directory>

if supported by the OS. If successful, you need a full file system check, in order to collect the dangling file inode and its data blocks.
I successfully did that a couple of times on a non-journaling UFS in single-user mode (no desktop, no other processes running).

I would go for a disk editor. Find the offending name, compare the shown bytes with the characters from the ls command, change one byte, save, compare again, ...
# 6  
Old 07-20-2019
Here is an OSX man page for clri

Code:
https://www.unix.com/man-page/osx/8/clri/

Also available as an OpenDarwin man page:

Code:
https://www.unix.com/man-page/opendarwin/8/clri/

Quoting:

Quote:
Clri is obsoleted for normal file system repair work by fsck(8).

Clri zeros out the inodes with the specified inode number(s) on the filesystem residing on the given special_device. The fsck(8) utility is
usually run after clri to reclaim the zero'ed inode(s) and the blocks previously claimed by those inode(s). Both read and write permission
are required on the specified special_device.

The primary purpose of this routine is to remove a file which for some reason is not being properly handled by fsck(8). Once removed, it is
anticipated that fsck(8) will be able to clean up the resulting mess.
These 3 Users Gave Thanks to Neo For This Post:
# 7  
Old 07-31-2019
I don't use OSX, but perhaps this would work.

Code:
ls -i
1180383 weird-file.txt
jon@ranger:one space$ find . -inum 1180383 -delete

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