"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Given that you have a specific target file (hence its inode and the number of links to that inode), then why not just use the normal unix "find" utility:
I haven't tried benchmarking that but based on prior experience, if you happen to be searching over any really large directory trees (thousands of files), I know that this approach will be at least 5 or 6 times faster than any solution involving File::Find. (I have posted at least three benchmarks on PM to prove this.) It also seems a lot simpler. Since you're looking specifically for hard links (files with identical inodes), the issue of portability to non-unix systems is irrelevant. The unix "find" command is the right tool for this job (and perl just makes it easier to use "find", which is worthwhile). (update: simplified the "printf" statement a little; also should clarify that the "5 to 6 times faster" is in terms of wall-clock time to finish a given run.) (another update: after simplifying the printf, I put the args in the right order so that the output is correct.) In reply to Re: aborting File::Find::find
by graff
|
|