I am converting files from an old application to OS X. For reasons that must have been good at the time, it writes related files to its database using inode numbers. (I think Apple calls it FileID.)
Given the file name, I can find the inode in Python using os.stat (). But is there a Python way to find the name with the inode number?
Otherwise, I can think of two other ways:
Scan all files in a folder to collect all their inode numbers and save them in a dictionary for quick reference.
Use os.system ('find / folder / folder -inum 1234') and parse the output for what I need. I believe that this does the same as above, but is performed by the operating system.
I would prefer my own Python solution, but would be grateful for any other suggestions.
This will be Python2 on OS X 10.5 or 6.
source share