summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-07-09 23:58:43 +0000
committerivan <ivan>2009-07-09 23:58:43 +0000
commit1cf09d80c37393560d1fd831ec1aa04354e09d6a (patch)
treeb92adfd6dba59c86664bc180ce7d3fcd2973dfe3 /FS
parent2ab9eb8640221cb01b06a818651cb5797431a146 (diff)
add -r option
Diffstat (limited to 'FS')
-rwxr-xr-xFS/bin/freeside-cdr-sftp_and_import11
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 c4484f1d4..18de94ddf 100755
--- 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
###
-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 =~ /^\./;
@@ -39,6 +39,9 @@ warn "Retreiving directory listing\n" if $opt_v;
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 );
###
@@ -104,7 +107,7 @@ cdr.sftp_and_import - Download CDR files from a remote server via SFTP
=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
@@ -115,6 +118,8 @@ import them into the database.
-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