in reply to Modifying a directory file

If perl is better at seeing that file than others, did you try rename or File::Copy?

Edit: I realized I misread your post and thought you could open the file. Still worth a try I guess?

Replies are listed 'Best First'.
Re^2: Modifying a directory file
by davidgl (Novice) on Jan 05, 2018 at 14:24 UTC

    I can't use anything that specifies the file by name as the name is effectively null. Perl tends to have more direct access to system calls and system library functions. I haven't written in C for around 25 years, and never on a Mac, so Perl would be easier.

    The approaches I can see are:

    a) rename the file

    b) remove the inode-equivalent from the directory entry and let fsck fix it. (FS is Apple's HFS+)

    c) set the inode use count to zero and let fsck tidy it. (Can a stat() structure be re-written to do that, or is that trapped?)

    Thanks, David