|P is for Practical|
Modifying a directory fileby davidgl (Novice)
|on Jan 05, 2018 at 13:26 UTC||Need Help??|
davidgl has asked for the wisdom of the Perl Monks concerning the following question:
I'm asking this as a result of someone who has an 'impossible' problem on their Mac asking on a Mac list.
They have a file that originated before MacOS X, that is before the Mac OS became Unix based. The first three characters of the filename are NULLs. Needless to say, any Unix function that tries to manipulate that file fails at the name -> inode lookup stage because the filename string terminates at the first char.
I fixed a similar problem around 35 years ago by doing a binary edit on the directory file, but that option is no-longer available, especially on a Mac, so I'm looking at Perl. I am reasonably familiar with Perl, but not an expert.
In Perl I can opendir() and readdir() to find the entry but that doesn't give me the rest of the directory entry structure. If I had that, I could change the name and hopefully re-write the directory file.
Does anyone have any pointers? I can't think of any other group where I would find real 'bit twiddlers'.