Can Ftp2.SyncLocalTree be progress monitored?
The FTP2 component’s SyncLocalTree method downloads an entire directory tree from an FTP server to the local filesystem. There are several modes of operation:
mode=0: Download all files
mode=1: Download all files that do not exist on the local filesystem.
mode=2: Download newer or non-existant files.
mode=3: Download only newer files. If a file does not already exist on the local filesystem, it is not downloaded from the server.
It is possible to monitor activity via the AbortCheck event. The AbortCheck event is called periodically according to the HeartbeatMs property setting. The AbortCheck callback method has one argument: an output-only “abort” flag. If set to true (non-zero), the FTP2 component will abort the SyncLocalTree.
It is not possible to monitor a percentage completion (i.e. 0% to 100%). The reason is that it is impossible to know the full extent of the remote directory tree and files to be downloaded. There is nothing in the FTP protocol that allows a client to ask the server to “give me the sum of the sizes of all files in a directory tree”. The SyncLocalTree works by traversing the directory tree through a series of “change directory” commands, downloading files in each directory found, etc.