The ftp structure lets you transfer files between networked machines from the Scheme Shell, using the File Transfer Protocol as described in RFC 959.
Some of the procedures in this module extract useful information from the server's reply, such as the size of a file, or the name of the directory we have moved to. These procedures return the extracted information, or, if the server's response doesn't match the expected code from the server, a catchable ftp-error is raised.
Open a command connection with the remote machine host and login on that server with login and password. Login and password can be #f, in which case the information is extracted from the user's .netrc file if necessary.If log-port is specified, it must be an output port: this starts logging the conversation with the server to that port. Note that the log contains passwords in clear text.
This change the transfer mode for future file transfers. The transfer mode is specfified by ftp-type which can be created with the ftp-type macro. <.Name.> must be either binary for binary data or ascii for text.
This changes the name of old on the remote host to new (assuming sufficient permissions). Old and new are strings.
This deletes file from the remote host (assuming the user has appropriate permissions).
This changes the current directory on the server.
This move to the parent directory on the server.
Return the current directory on the remote host, as a string.
This returns a list of filenames on the remote host, either from the current directory (if dir is not specified), or from the directory specified by dir.
This returns a list of long-form file name entries on the remote host, either from the current directory (if dir is not specified), or from the directory specified by dir. (Note that the format for the long-form entries is not specified by the FTP standard.)
This downloads remote-file from the FTP server. Ftp-get establishes a data conneciton to the server, attaches an input port to the data connection, and calls proc on that port.
This uploads remote-file to the FTP server. Ftp-put establishes a data conneciton to the server, attaches an output port to the data connection, and calls proc on that port.
This appends data to remote-file on the FTP server. Ftp-append establishes a data conneciton to the server, attaches an output port to the data connection, and calls proc on that port.
This removes the directory dir from the remote host (assuming sufficient permissions).
This create a new directory named dir on the remote host (assuming sufficient permissions).
This requests the time of the last modification of file on the remote host, and on success return a Scsh date record. (This command is not part of RFC 959 and is not implemented by all servers, but is useful for mirroring.)
This returns the size of file in bytes. (This command is not part of RFC 959 and is not implemented by all servers.)
This closes the connection to the remote host. The connection object is useless after a quit command.
This sends a command verbatim to the remote server and wait for a response. The response text is returned verbatim.
This returns #t if thing is a ftp-error object, otherwise #f.
These procedures are useful for downloading and uploading data to an FTP connection via ftp-get, ftp-get, and ftp-append. They all copy data from one port to another. Copy-port->port-binary copies verbatim, while the other two perform CR/LF conversion for ASCII data transfers. Copy-port->port-ascii adds CR/LFs at line endings on output, whereas Copy-ascii-port->port removes CR/LFs at line endings end replaces them by ordinary LFs.