projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
376b1df
)
freeside-cdr-sftp_and_import: add an option to gunzip imported files
author
levinse
<levinse>
Wed, 22 Jun 2011 17:22:51 +0000
(17:22 +0000)
committer
levinse
<levinse>
Wed, 22 Jun 2011 17:22:51 +0000
(17:22 +0000)
FS/bin/freeside-cdr-sftp_and_import
patch
|
blob
|
history
diff --git
a/FS/bin/freeside-cdr-sftp_and_import
b/FS/bin/freeside-cdr-sftp_and_import
index
384f9e5
..
e09f7dc
100755
(executable)
--- 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
###
# 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:a
g
');
$opt_e ||= 'csv';
#$opt_e = ".$opt_e" unless $opt_e =~ /^\./;
$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;
}
warn "Processing $filename\n" if $opt_v;
+
+ my $ungziped = $filename;
+ my $ungziped =~ s/\.gz$//;
+ system("gunzip $cachedir/$filename") if $opt_g;
my $import_options = {
my $import_options = {
- 'file' => "$cachedir/$
filename
",
+ 'file' => "$cachedir/$
ungziped
",
'format' => $format,
'batch_namevalue' => $filename,
'empty_ok' => 1,
'format' => $format,
'batch_namevalue' => $filename,
'empty_ok' => 1,
@@
-119,6
+123,7
@@
foreach my $filename ( @$ls ) {
}
unlink "$cachedir/$filename";
}
unlink "$cachedir/$filename";
+ unlink "$cachedir/$ungziped" if $opt_g;
}
}