FtpHandle | Handle for FTP connection. |
Directory | Directory to download from / to. Same on remote and local. Use relative path. |
OverwritePolicy | If there are local copies with the same name, then when to overwrite them. Options are: OverwriteAll, RemoteNewer, SizeDifferent, RemoteNewerOrDifferent, RemoteNewerAndDifferent. |
RecursePolicy | Whether to just handle the files or should also recurse into subdirectories. Options are: RecurseIntoSubdirectories and NoRecurse. |
DeleteUnmatchedPolicy | If at the end, there are local files without any matching remote files, should they be cleaned out or kept. Options are: DeleteUnmatched and LeaveUnmatched. |
Local and remote directory have to have the same name. The command will cd into the directory on both ends to start with. Prior to making this call, you can cd and ftp::Cd yourself through the part of the path that is different, and then make the call (see example).
Note that if you want to do mirroring or you want to do the equivalent of a copy-and-paste, there are the FtpMirrorRemoteToLocal and FtpDownloadSite commands.
Currently, there is no way to do the following: both (a) delete all unmatched files and also at the same time (b) leave unmatched directories.
If you set the NoRecurse option and the same directory is on both sides, then that directory will still be considered matched, and so it will not be deleted.
% set FtpHandle [ftp::Open $IpAddress $Username $Password]
% cd c:/my/local/folder
% ftp::Cd /home/my/directory
% FtpDownloadDirectory $FtpHandle start OverwriteAll RecurseIntoSubdirectories LeaveUnmatched