Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How can I download directories and files from an FTP server using Perl?
- use Net::FTP;
- use Net::FTP::File;
- my $ftp=Net::FTP->new("hostname");
- $ftp->login("username","password");
- $ftp->cwd("/repository_name");
- my @ftp_lists=$ftp->ls("/repository_name ");
- foreach my $ftp_file(@ftp_lists){
- push @ftp_dirs, $ftp_file if($ftp->isdir($ftp_file));
- push @ftp_files, $ftp_file if($ftp->isfile($ftp_file));
- }
- my $username = "tim";
- my $password = "asdfghj";
- my $domain = "example.com";
- my $get = `wget -P /var/www/$domain/ -m ftp://$username:$password@$domain/httpdocs`;
- my $mv = `mv /var/www/$domain/httpdocs/* ../`;
- my $del = `rm /var/www/$domain/httpdocs/`;
Add Comment
Please, Sign In to add comment