-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmpress_and_md5.pl
48 lines (42 loc) · 895 Bytes
/
cmpress_and_md5.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!usr/bin/perl -w
use strict;
use warnings;
use Getopt::std;
my($dir,$od);
Getoptions(
"indir:s" =>\$dir,
"od:s" => \$od,
"h|?" => \&USAGE,
) or &USAGE;
if(undef($dir) ||undef($od)){
print("your input parameter wrong,please check carefully\n");
&USAGE;
}
opendir(DIR,"$dir") or die "Cannot open dir:$!";
mkdir($od,0777) or die "$!" unless(-d $od);
for my $file(readdir DIR){
next if($file eq "." or $file eq "..");
if( -e $file){
my $cmpress="gzip $file >$od";
system($cmpress);
}
}
closedir DIR;
opendir(DIR,$od) or die "$!";
for my$file(readdir DIR){
next if($file eq "." or $file eq "..");
my $md5sum="md5sum $file > gz.md5";
system($md5sum);
}
closedir DIR;
sub USAGE{
my $usage=<<USAGE;
------------------------
Contact:honghh\@biomarker.com.cn
USAGE:
cmpress_and_md5sum.pl -indir <indir> -od <outdir>
------------------------
USAGE
print $usage;
exit(1);
}