I am trying to connect to a FTP server using perl. I am using the below code and when I run the code in CMD I get nothing in return therefore I think it has made a connection.
I am wondering if there is a way copy a CSV file from my desktop to the FTP sever. However the CSV filename is different every time for example,
File_2017_10_23 - 10.29.20
File_2017_10_23 - 13.40.20
As you can see the CSV file grabs the current date and time every time the file is generated.
I am using WINSCP to connect to my FTP server.
The perl script:
use strict; # Don't forget !
use Net::FTP;
my $host = "your.favorite.server";
my $user = "user";
my $password = "password";
my $put_file = 'filename.csv';
my $dir = 'C:\Users\Rich\Desktop';
my $f = Net::FTP->new($host) or die "Can't open $host\n";
$f->login($user, $password) or die "Can't log $user in\n";
$f->cwd($dir) or die "Unable to cwd to $dir\n";
$f->put($put_file) or die "Unable to put $put_file\n";
Could someone show me how this is done please.