HowTo:Warranty Claims: Difference between revisions
No edit summary |
|||
| Line 26: | Line 26: | ||
<br> | <br> | ||
The warranty rate set on this screen will auto populate into the main warranty screen when you select the “Warranty Performed By” company. | The warranty rate set on this screen will auto populate into the main warranty screen when you select the “Warranty Performed By” company. | ||
<syntaxhighlight lang="perl">#!/usr/bin/perl | |||
use strict; | |||
use File::Basename; | |||
use File::Copy; | |||
use Net::FTP; | |||
my $ftpServer = 'mft.gannett.com'; | |||
my $ftpUsername = 'janesville'; | |||
my $ftpPassword = 'ky31th9d'; | |||
my $ftpDestFolder = 'incoming'; | |||
my $srcFolder = '/app/pbs/exchange/cm'; | |||
my $mvFolder = '/app/pbs/exchange/cm/completed'; | |||
my $ftp = Net::FTP->new($ftpServer, Debug => 1) | |||
or die "Cannot connect to hostname: $@"; | |||
$ftp->login($ftpUsername, $ftpPassword) | |||
or die "Cannot login ", $ftp->message; | |||
if (length($ftpDestFolder) > 0) { | |||
$ftp->cwd($ftpDestFolder) | |||
or die "Cannot change working directory ", $ftp->message; | |||
} | |||
opendir(DIR, $srcFolder); | |||
my @files = readdir(DIR); | |||
closedir(DIR); | |||
foreach my $file (@files) { | |||
if (not -d $file) { | |||
if ($file =~ /JGAudit|JGTran.*/ && $file =~ /\.txt$/) { | |||
my $err = 0; | |||
$ftp->put("$srcFolder/$file") or $err = 1; | |||
if (!$err) { | |||
move("$srcFolder/$file", "$mvFolder/$file"); | |||
} | |||
} | |||
} | |||
} | |||
$ftp->quit();</syntaxhighlight> | |||