FtpMirrorRemoteToLocal — Make local site match what remote has.
FtpMirrorRemoteToLocal RemoteDirectory LocalDirectory
Return Value
RemoteDirectoryPath to download from.
LocalDirectoryPath to download to.
More Info
See About FTP Use for additional details.

Caution! This command may overwrite or delete files. See the FTP page for details about setting up to use a dry run. With a dry run you can see what the command would have done.

The purpose of this command to make the local directory have the same contents as the remote directory by (1) downloading the any files on the remote machine that are newer or have a different size and (2) deleting any files on the local machine where there is no matching file on the remote machine.

Again, note that even if a file on the local machine is newer, if its file size is different then it will be overwritten by a copy of the remote version.

To use this command you will need to have configured the server IP, username, and password to use. See here for details.

The command works as follows: (1) It opens an FTP connection using the configuration, (2) If any file transfer type has been set then it switches to that type, (3) It switches to the local and remote directories passed in, (4) It downloads the contents of the remote directory to the local, (5) It cleans up any unmatched local files, (6) It switches back to the directory it was in before the command was called and closes the connection.

If an error occurs in the middle, this command will not try to rollback or anything like that. It will simply close the connection and return to the starting local directory.

The command will copy not only the files in the remote directory, but the subdirectories and their contents as well. It will make directories on the local end if necessary.

Note that this command does not guarantee the contents of remote and local will be the same. This will only download if the sizes are different or the remote is newer. So it could somehow be the case that the local is newer, file sizes are the same, and yet the contents are different, and so that file would be skipped. If this scenario is a concern, then it may be better to simply completely delete the local directory and then do an FtpDownloadSite to get all contents. (Or you may want to use a more sophisticated tool.)

If between this command and FtpDownloadSite, you cannot make uploading work how you want, you may wish to look at the source code, look at FtpDownloadDirectory, and then work out your own command. This command is intended to be very simple and quick-to-use, and so it lacks in flexibility.

For information regarding exceptions / errors, see here.
% FtpMirrorRemoteToLocal /home/username/folder c:/users/username/documents/folder
FtpDownloadDirectory, FtpDownloadSite, FtpMirrorLocalToRemote
file, network