inode number -> pathname? (4.2BSD)

Tim Curry tim at ucf-cs.UUCP
Wed Jul 10 03:46:49 AEST 1985


>From rsf at Shasta.ARPA Sun Feb  6 01:28:16 206
Newsgroups: net.unix-wizards
Subject: inode number -> pathname? (4.2BSD)
Organization: Stanford University

>I am looking for a good way to generate the full path name of a directory, 
>given only its inode number (plus the device number of its filesystem).
>Does anyone know if there's a good way to do this in 4.2BSD?  Clearly, being 
>able to chdir to the directory, given only its device and inode numbers, 
>would be sufficient for my needs.

>The 'obvious' solution is to open the file system as a device, parse the data 
>structures to find the appropriate inode, and then follow the ".." entries to 
>construct the pathname (this is effectively what "ncheck" does).
>However, I'd prefer a cleaner solution if at all possible.

How about:

	find / -inum inode-number -print
-- 
Tim Curry
USENET:  decvax!ucf-cs!tim
ARPANET: tim.ucf-cs at csnet-relay



More information about the Comp.unix.wizards mailing list