Getting unique IDs / inodes for files

I need to get hold of unique and persistent identifiers for a set of files. I know that the command
ls -i
in the terminal brings back the inode and file name for each file in a folder. Is there a way to retrieve the inode value in Xojo? I’ve looked at the Einhugur FolderItemInfo plugin but that doesn’t seem to pick up the inode value unless I’m missing something. I have seen references to NSFileSystemFileNumber elsewhere but I can’t work out how to get a handle on it.

Any advice you can give would be appreciated.

Ian.

I’m hazy on the details but I believe you might want to look at NSURL’s bookmark feature. It is persistent even if the file is moved, renamed, etc.

I looked into this further. macOSLib has support for NSURL that includes bookmark data. You can save the bookmark data, which is a string of arbitrary bytes, and later recreate the NSURL from the saved bookmark data. If you’re familiar with alias records, this is a close analogue to those.

macOSLib even has built-in conversion to and from Xojo’s native FolderItem, so this can be a fairly seamless way to do it.

Thanks for pointing me to this. I have never heard of macOSLib but it looks quite useful. I will take a look at it.