# ftp - perldoc - phpman

> **TLDR:** Tools to interact with a server via File Transfer Protocol.
>
- Connect to an FTP server and run in interactive mode:
  `ftp {{ftp.example.com}}`
- Connect to an FTP server specifying its IP address and port:
  `ftp {{ip_address}} {{port}}`
- [Interactive] Switch to binary transfer mode (graphics, compressed files, etc):
  `binary`
- [Interactive] Transfer multiple files without prompting for confirmation on every file:
  `prompt off`
- [Interactive] Download multiple files (glob expression):
  `mget {{*.png}}`
- [Interactive] Upload multiple files (glob expression):
  `mput {{*.zip}}`
- [Interactive] Delete multiple files on the remote server:
  `mdelete {{*.txt}}`
- [Interactive] Rename a file on the remote server:
  `rename {{original_filename}} {{new_filename}}`

*Source: tldr-pages*

---

## Found in /usr/share/perl/5.34/pod/perlfaq8.pod
  Can I use perl to run a telnet or ftp session?
    Try the [Net::FTP](https://www.chedong.com/phpMan.php/perldoc/Net%3A%3AFTP/markdown), [TCP::Client](https://www.chedong.com/phpMan.php/perldoc/TCP%3A%3AClient/markdown), and [Net::Telnet](https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ATelnet/markdown) modules (available from
    CPAN). <<http://www.cpan.org/scripts/netstuff/telnet.emul.shar>> will also
    help for emulating the telnet protocol, but [Net::Telnet](https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ATelnet/markdown) is quite
    probably easier to use.

    If all you want to do is pretend to be telnet but don't need the initial
    telnet handshaking, then the standard dual-process approach will
    suffice:

        use [IO::Socket](https://www.chedong.com/phpMan.php/perldoc/IO%3A%3ASocket/markdown);             # new in 5.004
        my $handle = [IO::Socket::INET](https://www.chedong.com/phpMan.php/perldoc/IO%3A%3ASocket%3A%3AINET/markdown)->new('www.perl.com:80')
            or die "can't connect to port 80 on www.perl.com $!";
        $handle->[autoflush(1)](https://www.chedong.com/phpMan.php/man/autoflush/1/markdown);
        if (fork()) {               # XXX: undef means failure
            select($handle);
            print while <STDIN>;    # everything from stdin to socket
        } else {
            print while <$handle>;  # everything from socket to stdout
        }
        close $handle;
        exit;

## Found in /usr/share/perl/5.34/pod/perlfaq9.pod
  How do I fetch/put an (S)FTP file?
    [Net::FTP](https://www.chedong.com/phpMan.php/perldoc/Net%3A%3AFTP/markdown), and [Net::SFTP](https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ASFTP/markdown) allow you to interact with FTP and SFTP (Secure
    FTP) servers.

