diff options
author | levinse <levinse> | 2011-06-22 17:22:51 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-06-22 17:22:51 +0000 |
commit | 8576e8afd3dd67871906f1a96cfbf333180f2c55 (patch) | |
tree | e1e63198e7b74f0db2a95603636ab7005f5ad7dd | |
parent | 376b1dfc27736a2d7060ad0ca140565c9d3de55d (diff) |
freeside-cdr-sftp_and_import: add an option to gunzip imported files
-rwxr-xr-x | FS/bin/freeside-cdr-sftp_and_import | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/FS/bin/freeside-cdr-sftp_and_import b/FS/bin/freeside-cdr-sftp_and_import index 384f9e57c..e09f7dc58 100755 --- a/FS/bin/freeside-cdr-sftp_and_import +++ b/FS/bin/freeside-cdr-sftp_and_import @@ -11,8 +11,8 @@ use FS::cdr; # parse command line ### -use vars qw( $opt_m $opt_p $opt_r $opt_e $opt_d $opt_v $opt_P $opt_a $opt_c ); -getopts('c:m:p:r:e:d:v:P:a'); +use vars qw( $opt_m $opt_p $opt_r $opt_e $opt_d $opt_v $opt_P $opt_a $opt_c $opt_g ); +getopts('c:m:p:r:e:d:v:P:ag'); $opt_e ||= 'csv'; #$opt_e = ".$opt_e" unless $opt_e =~ /^\./; @@ -93,9 +93,13 @@ foreach my $filename ( @$ls ) { } warn "Processing $filename\n" if $opt_v; + + my $ungziped = $filename; + my $ungziped =~ s/\.gz$//; + system("gunzip $cachedir/$filename") if $opt_g; my $import_options = { - 'file' => "$cachedir/$filename", + 'file' => "$cachedir/$ungziped", 'format' => $format, 'batch_namevalue' => $filename, 'empty_ok' => 1, @@ -119,6 +123,7 @@ foreach my $filename ( @$ls ) { } unlink "$cachedir/$filename"; + unlink "$cachedir/$ungziped" if $opt_g; } |