Page 1 of 1

FTP Download only files wich are New

PostPosted: Fri Sep 29, 2017 5:35 am
by Dudus
Hi,

can you tell me how to download files from FMFTP without overwrite? for example:
C:\TEST contains
01.txt
02.txt
03.txt

FTP Remote directory has
01.txt
02.txt
03.txt
and 04.txt

In this case download only 04.txt file because the 1,2,3 are already in my local directory.
Please help me.

Thank you!
Dudus

Re: FTP Download only files wich are New

PostPosted: Sat Sep 30, 2017 7:04 pm
by Gaev
Dudus:

Here is the gist of the script ...
Code: Select all
fmConnectLocal "local connection id" "host" "properties"

fmConnectRemote "remote connection id" "host" "properties"
fmChangeDir "remote connection id" "path"
(optional) fmSetFileMask "remote connection id" "*.txt"
fmFileListToVar "remote connection id" "FullPath=No;IncludeFiles=Yes; IncludeFolders=No;SelectedOnly=No" "[Files]"

StrParse "[Files]" "!;" "[FilesArray]" "[FilesArrayLen]"

Loop "1" "[FilesArrayLen]" "[thisFileNumber]"
   SetVar "[thisFileName]" "[FilesArray[thisFileNumber]]"
     
   fmFileExists "local connection id" "!c:\TEST\[thisFileName]" "[Result]"
   If "[Result]" "<>" "True"
      fmCopyFrom "remote connection id" "[thisFileName]" "!C:\TEST" "options"
   EndIf
EndLoop