http://qs321.pair.com?node_id=1206758


in reply to Modifying a directory file

Do you know why this person has a file which sounds like it is, frankly, corrupt? If its filename starts with 3 null characters, then I wouldn't necessarily expect the file to contain anything useful. I would immediately suspect that the transfer process, whatever it was, has gone tragically wrong. :-)

Replies are listed 'Best First'.
Re^2: Modifying a directory file
by davidgl (Novice) on Jan 05, 2018 at 17:18 UTC
    The file is a hang-over from when his data tree was on a MacOS9 system. Under that OS and earlier the string delimiter was other than NULL, so it would be a legal filename back then. He just wants to delete the file. It is currently in his 'Trash' ( = 'Recycle bin') and emptying it fails. Unfortunately he has been able to create another file of the same name by using the Finder to copy and paste the name, but once set it cannot be replaced.

    I don't know how the file was copied from the old OS9 system, but any raw inode level copy would work. It could even be the old OS9 Mac drive.

    David

      Now that you say that the goal is to remove the file, I would try deleting it by inode, bypassing the filename altogether. A combination of ls & find will probably do the job. Web searches should turn up a useful recipe. If that failed, I would cheerfully ignore it in the knowledge that the drive is going to die some day. I'm mildly curious as to how it got to Trash (since files don't tend to originate there, so it was moved there by something). Not curious enough to experiment though. I have a list of quixotic tasks I'm working on already.