in reply to How do I verify that a copied file's contents did not corrupt/modify?
#! /usr/bin/perl -w use strict; use Digest::MD5; my $orig = shift or die "no original given\n"; my $dup = shift or die "no copy given\n"; open ORIG, $orig || die "Cannot open $orig for input: $!\n"; my $origmd5 = Digest::MD5->new; my $origdig = $origmd5->addfile( *ORIG )->digest; close ORIG; open DUP, $dup || die "Cannot open $dup for input: $!\n"; my $dupmd5 = Digest::MD5->new; my $dupdig = $dupmd5->addfile( *DUP )->digest; print( $origdig ne $dupdig ? 'not ' : '', "ok\n" );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I verify that a copied file's contents did not corrupt/modify?
by idnopheq (Chaplain) on Mar 14, 2001 at 17:59 UTC |