On Jul 4, 2006, at 12:13 PM, Timo Hoepfner wrote:

> Hi,
>
> is there a way to retrieve a file's path by inode number? Basically  
> the opposite of:
>
> File.stat("/tmp/test").ino
> => 2178494
>
> Background: I want to track files in a database, and want to keep  
> track of them even when they're moved or renamed.
>
> Apple is doing something similar on MacOS with Aliases. Internally,  
> a path and a fileID (=inode) is stored. When an alias is to be  
> resolved, it first tries to find it by path and falls back to  
> locating it by fileID.
>
> Timo
>
>

No. File paths are not associated with the i-node data structure in  
an inode based fs. (An inode does not know the file name, only the  
associated blocks). The file name is stored in the directory entry.  
You'd have to search every directory entry on disk to see if it's  
inode was the one you were trying to keep track of.