Hello Perl beginner with no name,
Hello I'm a perl beginner, I want to create a folder in a ftp using
perl, can anyone give me a help?
I know to use Net::FTP reference, but I don't know the detail function
to create a folder.
Try this (after modifying to add in your own values for $host, $login
and $passwd):
Regards,
Simon Taylor
#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
my $host = 'nnn.nnn.nnn.nnn';
my $debug = 0;
my $login = 'xxxxxx';
my $passwd = 'xxxxxx';
my $folder = 'new_folder';
my $ftp = Net::FTP->new($host, Debug => $debug)
or die "Cannot connect to $host";
$ftp->login($login, $passwd)
or die "Cannot login to $host";
$ftp->mkdir($folder)
or die "Cannot create $folder " . $ftp->message;
$ftp->quit();
exit 0;