octave: FTP Objects
36.4.1 FTP Objects
------------------
Octave supports the FTP protocol through an object-oriented interface.
Use the function ‘ftp’ to create an FTP object which represents the
connection. All FTP functions take an FTP object as the first argument.
-- : F = ftp (HOST)
-- : F = ftp (HOST, USERNAME, PASSWORD)
Connect to the FTP server HOST with USERNAME and PASSWORD.
If USERNAME and PASSWORD are not specified, user "anonymous" with
no password is used. The returned FTP object F represents the
established FTP connection.
The list of actions for an FTP object are shown below. All
functions require an FTP object as the first argument.
Method Description
-----------------------------------------------------------------------
ascii Set transfer type to ascii
binary Set transfer type to binary
cd Change remote working directory
close Close FTP connection
delete Delete remote file
dir List remote directory contents
mget Download remote files
mkdir Create remote directory
mput Upload local files
rename Rename remote file or directory
rmdir Remove remote directory
-- : close (F)
Close the FTP connection represented by the FTP object F.
F is an FTP object returned by the ‘ftp’ function.
-- : mget (F, FILE)
-- : mget (F, DIR)
-- : mget (F, REMOTE_NAME, TARGET)
Download a remote file FILE or directory DIR to the local directory
on the FTP connection F.
F is an FTP object returned by the ‘ftp’ function.
The arguments FILE and DIR can include wildcards and any files or
directories on the remote server that match will be downloaded.
If a third string argument TARGET is given, then it must indicate
the path to the local destination directory. TARGET may be a
relative or absolute path.
-- : mput (F, FILE)
Upload the local file FILE into the current remote directory on the
FTP connection F.
F is an FTP object returned by the ftp function.
The argument FILE is passed through the ‘glob’ function and any
files that match the wildcards in FILE will be uploaded.
-- : cd (F)
-- : cd (F, PATH)
Get or set the remote directory on the FTP connection F.
F is an FTP object returned by the ‘ftp’ function.
If PATH is not specified, return the remote current working
directory. Otherwise, set the remote directory to PATH and return
the new remote working directory.
If the directory does not exist, an error message is printed and
the working directory is not changed.
-- : LST = dir (F)
List the current directory in verbose form for the FTP connection
F.
F is an FTP object returned by the ‘ftp’ function.
-- : ascii (F)
Set the FTP connection F to use ASCII mode for transfers.
ASCII mode is only appropriate for text files as it will convert
the remote host’s newline representation to the local host’s
newline representation.
F is an FTP object returned by the ‘ftp’ function.
-- : binary (F)
Set the FTP connection F to use binary mode for transfers.
In binary mode there is no conversion of newlines from the remote
representation to the local representation.
F is an FTP object returned by the ‘ftp’ function.
-- : delete (F, FILE)
Delete the remote file FILE over the FTP connection F.
F is an FTP object returned by the ‘ftp’ function.
-- : rename (F, OLDNAME, NEWNAME)
Rename or move the remote file or directory OLDNAME to NEWNAME,
over the FTP connection F.
F is an FTP object returned by the ftp function.
-- : mkdir (F, PATH)
Create the remote directory PATH, over the FTP connection F.
F is an FTP object returned by the ‘ftp’ function.
-- : rmdir (F, PATH)
Remove the remote directory PATH, over the FTP connection F.
F is an FTP object returned by the ‘ftp’ function.