Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Oh, well of course! I used an external find command because as I stressed, I just wanted to keep minimal and using File::Find, as I would most probably do in a more realistic case1, was not substantial for the technique I wanted to explore...

You'll also notice that I used -ln on a slightly longer script than I would usually do in "production", whatever that is.

But in the above you're fundamentally using Perl as a shell script. That is really "kinda too much". Incidentally you're using the "inner" find just to print the inode number. In that case the external stat command would suffice:

$ stat -c %i work/ 18972756

OTOH I didn't know about -inum, so I thank you - I know it's out there in the docs, but I tend to learn by example...

Also, as a final observation, I think that indeed the OP was really asking about how to find hard links sharing the same inode as a given file, that is what you actually do. But if you want to search a whole directory hierarchy like I did, a "pure-find" approach along the lines of your example would be unpractical, since I think it would necessarily take two nested find's.



1 And if I called an external find cmd, I'd probably use an explicit open.

In reply to Re^3: Finding Hard links by blazar
in thread Finding Hard links by jesuashok

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 15:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found