Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Bitwise comparision of files

by Limbic~Region (Chancellor)
on Feb 28, 2012 at 18:27 UTC ( #956723=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Bitwise comparision of files
in thread Bitwise comparision of files

kelly,
Based on this explanation, you are going to want to take a look at File::Find. There are other modules on CPAN that try to make up for the horrendous call-back interface but the point is - don't try and walk the directory structure yourself - you will make a mistake.

You are also going to want to take a look at File::Spec. There are a bunch of functions that will help you say things like chop off this portion of the path and replace it with this other path in order to determine if the file even exists in the other directory prior to comparing the actual file contents.

You probably also want to take a look at Digest::MD5. It isn't a great choice for cryptographical reasons but in order to determine if two files are or are not the same, it has a really simple interface and should work just fine.

If you want more help than that, you are going to have to show some more effort first.

Cheers - L~R


Comment on Re^3: Bitwise comparision of files
Re^4: Bitwise comparision of files
by kelly (Initiate) on Feb 28, 2012 at 18:47 UTC
    Thanks a lot guys, i will pursue the headsup . Basically my intention is not to simulate diff -r in Perl, rather the contents of the file bit-by-bit. Thanks once again.

      But that's what 'diff -r' does: compares the contents of two directory structures and reports any differences between the files, or files in one structure that are missing in the other. If you just want to know what files are different, without seeing the lines on which they are different, add the '-q' or '--brief' option.

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://956723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2014-08-27 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (250 votes), past polls