ot;'Craig Sharp'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, June 09, 2003 3:59 PM
Subject: RE: [Perl-unix-users] URGENT: Scan a directory and ftp if there are
files
> Now with sample code in-hand. Don't use FTP.
>
> FTP is insecure and should n
Craig Sharp wrote...
> I need a example of scanning a directory on a scheduled basis
> (crontab) for files. If there are files in the directory,
> those files need to be ftp'ed to a server and then deleted
> from the sending server. This is an automated incoming
> mailbox for EDI and the data
Now with sample code in-hand. Don't use FTP.
FTP is insecure and should not be used.
Take a look at using SSH/SCP.
There are perl modules for SCP, but I think that would be over kill a
simple shell or perl script would do.
Jimmy
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAI
UNTESTED SAMPLE CODE
#!/usr/bin/perl
net use Net::FTP
$DIRName = "/ftp/dir";
chdir $DIRName;
@Files = glob *;
$ftp = Net::FTP->new("HOST.DOMAIN.COM", Debug=>0);
$ftp->login("user", "password");
$ftp->cwd("/remote/dir");
foreach (@Files) {
$ftp->put($_);
}
$ftp->quit;
foreach (@Files