+ my $date = $opt{date};
+ my $file = $opt{agentnum} ? "agentnum$opt{agentnum}" : 'spool'; #.csv
+ unless ( -f "$dir/$file.csv" ) {
+ warn "$me $dir/$file.csv not found\n" if $DEBUG;
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+ return;
+ }
+ rename "$dir/$file.csv", "$dir/$file-$date.csv";
+
+ #ftp only for now
+ if ( $url =~ m{^ftp://([\w\.]+)(/.*)$}i ) {
+
+ my ($hostname, $path) = ($1, $2);
+ my $ftp = new Net::FTP ($hostname)
+ or die "can't connect to $hostname: $@\n";
+ $ftp->login($username, $password)
+ or die "can't login to $hostname: ".$ftp->message."\n";
+ unless ( $ftp->cwd($path) ) {
+ my $msg = "can't cd $path on $hostname: ".$ftp->message."\n";
+ ( $path eq '/' ) ? warn $msg : die $msg;
+ }
+ chdir($dir);
+ $ftp->put("$file-$date.csv")
+ or die "can't put $file-$date.csv: ".$ftp->message."\n";
+ $ftp->quit;