FtpMirrorLocalToRemote — Make remote site match what local site has.
FtpMirrorLocalToRemote LocalDirectory RemoteDirectory
Return Value
LocalDirectoryLocal directory to upload from.
RemoteDirectoryRemote directory to upload to.
More Info
See About FTP Use for additional details.

This command is for making the remote directory look just like the local directory.

To use this command you will need to have configured the server IP, username, and password to use. See here for 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.

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.

If between this command and FtpUploadSite, you cannot make uploading work how you want, you may wish to look at the source code, look at FtpUploadDirectory, 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.

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

You may encounter an issue where the directories created cannot be switched into because you have to set the permissions yourself. You may also want to check the documentation for your FTP server and/or do a search for how to configure it to allow users to create and use new directories.

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 local is newer. So it could somehow be the case that the remote 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 remote directory and then do a FtpUploadSite to get all contents. (Or you may want to use a more sophisticated tool.)

For information regarding exceptions / errors, see here.
% set FtpHandle [ftp::Open $GenNS::Ftp::Server $GenNS::Ftp::Username $GenNS::Ftp::Password {*}$GenNS::Ftp::OptionsList]
% FtpMirrorLocalToRemote c:/my/local/directory /home/my/remote/directory
FtpMirrorRemoteToLocal, FtpUploadDirectory, FtpUploadSite
file, network