Date: Sun, 11 Aug 2002 17:45:51 +0200 From: Erik Trulsson <ertr1013@student.uu.se> To: Michael Grant <mg-fbsd3@grant.org> Cc: freebsd-questions@freebsd.org Subject: Re: find by inode Message-ID: <20020811154550.GA50205@falcon.midgard.homeip.net> In-Reply-To: <200208111424.g7BEOxa29497@splat.grant.org> References: <200208111424.g7BEOxa29497@splat.grant.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 11, 2002 at 04:24:59PM +0200, Michael Grant wrote: > Does anyone know how I can list the files within a filesystem by inode > number? i.e. for each inode within a file system, print it's > filenames(s). And I do mean filename(s) because each inode can have > more than one link. > > I can write a perl script to do a find, build a hash, and print this > info out, but surely, there must be a more efficient way. > > For every given inode, I want to know what the filename(s) are. > Unfortunatly, ls doesn't provide this info. Unfortunately I don't think there is any efficient way to do this. An inode does not contain information on which filenames point to it. This means that the only way is to search through the entire filesystem and for each file check if it is a link to the desired inode. The only optimization one can do is that since an inode does know the number hardlinks to it that exists, one can stop once that number has been found. -- <Insert your favourite quote here.> Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020811154550.GA50205>