use Net::SSH2; $open=$ARGV[0]; if ($open eq "connect"){ my $ssh2 = Net::SSH2->new(); $ssh2->connect($host) or die; if ($ssh2->auth_password($user, $pass)) { print "Authorization successful\n"; $put=$ARGV[0]; $get=$ARGV[1]; # Send file if ($put eq "send") { $ssh2->scp_put("local file path","remote file path") or warn "Could not copy the file to the server"; } #Get file from server elsif ($get eq "get") { print "File Copied"; $ssh2->scp_get("remote file", "local file") or warn "Could not copy the file from the server"; } else { print "Error: Arguments entered must be either send or get\n"; exit; } } else { print "Authorization failure\n"; } } else { print "Error: Argument entered must be connect\n"; exit; }