[X-Unix] Can you get the path from an inode?
Craig A. Finseth
fin at finseth.com
Fri Apr 28 06:07:04 PDT 2006
...
I have an application which tells me only the inode number of a file it is
having problems with. Is there any way to get the path and filename from
the inode number?
...
You can get _a_ path (there may be many), but it is work.
- Start at the root of the volume.
- Loop through all entries in the directory
- See if you found your inode.
- If it's a directory, recurse on it
Note that the same inode may appear in multiple directories (assuming
that its the inode of a file rather than directory).
Also, with soft links, there may be many ways of entering any given
path.
Craig
More information about the X-Unix
mailing list