|Perl Monk, Perl Meditation|
Re: locate path to a file from inode numberby Daruma (Curate)
|on Nov 08, 2002 at 17:00 UTC||Need Help??|
Note that this is searching from the root, and can take quite a while. Not necessarily the most desirable of solutions, but it's worked in the past.
One of our applications makes very heavy use of hard links. Often our clients do not understand hard linking and might move things around or inadvertently break links. I've taken this very shell script idea and used it to help me reconcile the links and report on those that are misplaced, broken or completely missing.
Are you looking for a perl solution to your problem? If so, I've not yet developed something to trace down inodes. I would certainly like to give it a try, however. If you are looking for a basic shell utility, it's not hard to write one up.
I note that you mention the utility you saw previously did not use ls -i filename. However, many utilities on Unix systems are collections of the basic shell functions of the system, like ls and find. You might find that down in the workings of this utility, it is making use of good old Unix standard utilites.
Alternatively, it could be that this utility, if written in something like C, made use of the underlying C functions behind ls and find.
With a perl solution, it might be hard to get away from the heavy IO you are experiencing in File::Find. I do think it is worth a shot.