2

I am currently traversing directories of a bunch of servers using TLS encryption with Net::FTPSSL::Robust. I am wanting to download the files and then delete them as I download. I do NOT want to delete folder names.

Problem is, Robust only has a get() and it doesn't delete the files it takes. I know there has to be a way to do this. As you can see here, delete will not work since it's not part of Net::FTPSSL::Robust, though it IS part of Net::FTPSSL :

my $ftp = Net::FTPSSL::Robust->new
( Host    => $server->{'ip_address'}->{content}
, Port    => $port
, SECURITY_TLS => $encryption
, user  => $server->{'username'}->{content}
, password  => $server->{'password'}->{content}
, login_attempts => 3
);

$local_dir = $server->{'local_directory'}->{content} if($server->{'local_directory'}->{content});

# when needed, many attempts will be made to retrieve all
$ftp->get("/", "".$local_dir);
$ftp->delete("/") 

Can anyone shine some light on this or have a better solution? I'm completely new to Perl, so thanks in advance.

Derek R
  • 95
  • 1
  • 1
  • 8
  • Net::FTPSSL::Robust is a Net::FTP::Robust, which has the following [limitation](http://search.cpan.org/~markov/Net-FTP-Robust-0.08/lib/Net/FTP/Robust.pod#Limitations) with `get()`: *Files will not get deleted, not on the server and not on the client.* The focus of these modules seems to be on retrieving data, nothing more. – ThisSuitIsBlackNot Feb 11 '14 at 22:44

1 Answers1

-1

Why not just use Net::FTPSSL or Net::SSLGlue::FTP instead of Net::FTPSSL::Robust ? Do you need anything special from Net::FTPSSL::Robust which the other modules do not offer?

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • 1
    Because of its power. And the fact that it downloads large files autonomously and the way it handles potential errors. Are you saying I can't work around using Robust? – Derek R Feb 11 '14 at 22:33
  • Even if I use one of those other modules, how do I make sure I don't delete any folders? – Derek R Feb 11 '14 at 23:01
  • 1
    Because deleting a file and deleting a directory are different FTP commands, e.g. you cannot delete a directory as long as you don't issue an rmdir command. – Steffen Ullrich Feb 12 '14 at 05:39
  • Can I use something like FTPSSL or FTP::Recursive over TLS? – Derek R Feb 12 '14 at 06:22
  • Net::FTPSSL does TLS. Net::FTP does TLS too if you pimp it with Net::SSLGlue::FTP. I have no experience with Net::FTP::Recursive but from a short look at the code it just extends Net::FTP, so loading Net::SSLGlue::FTP should probably also make Net::FTP::Recursive be able to use TLS. – Steffen Ullrich Feb 12 '14 at 07:05