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'.

Thanks, David


In reply to Modifying a directory file by davidgl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.