projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2ab9eb8
)
add -r option
author
ivan
<ivan>
Thu, 9 Jul 2009 23:58:43 +0000
(23:58 +0000)
committer
ivan
<ivan>
Thu, 9 Jul 2009 23:58:43 +0000
(23:58 +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
c4484f1
..
18de94d
100755
(executable)
--- a/
FS/bin/freeside-cdr-sftp_and_import
+++ b/
FS/bin/freeside-cdr-sftp_and_import
@@
-10,8
+10,8
@@
use FS::cdr;
# parse command line
###
# parse command line
###
-use vars qw( $opt_p $opt_e $opt_d $opt_v );
-getopts('p:e:d:v');
+use vars qw( $opt_p $opt_
r $opt_
e $opt_d $opt_v );
+getopts('p:
r:
e:d:v');
$opt_e ||= 'csv';
#$opt_e = ".$opt_e" unless $opt_e =~ /^\./;
$opt_e ||= 'csv';
#$opt_e = ".$opt_e" unless $opt_e =~ /^\./;
@@
-39,6
+39,9
@@
warn "Retreiving directory listing\n" if $opt_v;
my $ls_sftp = sftp();
my $ls_sftp = sftp();
+$ls_sftp->setcwd($opt_r) or die "can't chdir to $opt_r\n"
+ if $opt_r;
+
my $ls = $ls_sftp->ls('.', wanted => qr/^$opt_p.*\.$opt_e$/i );
###
my $ls = $ls_sftp->ls('.', wanted => qr/^$opt_p.*\.$opt_e$/i );
###
@@
-104,7
+107,7
@@
cdr.sftp_and_import - Download CDR files from a remote server via SFTP
=head1 SYNOPSIS
=head1 SYNOPSIS
- cdr.sftp_and_import [ -p prefix ] [ -e extension ] [ -d donefolder ] [ -v ] user format [sftpuser@]servername
+ cdr.sftp_and_import [ -p prefix ] [ -e extension ] [ -
r remotefolder ] [ -
d donefolder ] [ -v ] user format [sftpuser@]servername
=head1 DESCRIPTION
=head1 DESCRIPTION
@@
-115,6
+118,8
@@
import them into the database.
-e: file extension, defaults to .csv
-e: file extension, defaults to .csv
+-r: if specified, changes into this remote folder before starting
+
-d: if specified, moves files to the specified folder when done
-v: verbose
-d: if specified, moves files to the specified folder when done
-v: verbose