Skip to content

Instantly share code, notes, and snippets.

@parastuffs
Created February 15, 2014 21:39
Show Gist options
  • Save parastuffs/9025560 to your computer and use it in GitHub Desktop.
Save parastuffs/9025560 to your computer and use it in GitHub Desktop.
Check crc32
#!/usr/bin/env perl
use strict;
use warnings;
#use diagnostics;
use String::CRC32;
open(FD1, "ls |");
my @files = <FD1>;
foreach my $f (@files) {
$f =~ s/\n//;
open(FD2,$f);
my $crc = crc32(*FD2);
close(FD2);
$crc = uc sprintf('%08x',$crc);
if($f =~ /\Q$crc/) {
print "$f\t OK\n";
}
else {
print "\t >>Please check $f \t $crc\n";
}
}
close(FD1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment