ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
Hi,
I need to compare local and remote directory (SYNC) but downloading updated files in another directory:
something like this:
FTP Script
  1. SYNC("C:\myfOLDER\folder","/FTP/folder", "C:\NewFileinThisDirectory", DOWNLOAD,SUBDIRS)
or something like this
after SYNC only downloaded files are moved elsewhere
I tried whit FOREACH but in list_type there only REMOTE_FILES (all Files) or LOCAL_FILES (all files).
I'd need a list_type like DOWNLADED_FILES with only the downloaded files....

Can you help me?
Hello, I am sorry but this is not possible. SYNC does not have that functionality.
I would try this... Without subdirs...
FTP Script
  1. $localfolder = "C:\Folder1"
  2. $remotefolder = "/Folder2"
  3. $downloadfolder = "C:\Folder3"
  4.  
  5. OPENHOST("ftp.myhost.com","joe","123456")
  6. CHDIR($remotefolder)
  7. LOCALCHDIR($localfolder)
  8.  
  9. $list = GETLIST(REMOTE_FILES)
  10.  
  11. FOREACH $item IN $list
  12.  
  13.   $remotetime = GETFILETIME(REMOTE, $item)
  14.   $remotesize = GETFILESIZE(REMOTE, $item)
  15.  
  16.   $localtime = GETFILETIME(LOCAL, $item)
  17.   $localsize = GETFILESIZE(LOCAL, $item)
  18.  
  19.   IF(($remotetime != $localtime) OR ($remotesize != $localsize))
  20.     LOCALCHDIR($downloadfolder)
  21.     GETFILE($item)
  22.     LOCALCHDIR($localfolder)
  23.   END IF
  24.  
  25.  
Note Caio that the Wandrey example only works if no subdirectories are used. And it would fail if FTP server and ScriptFTP does not have the same local time.

Thanks Wandrey. I am sure this will be useful anyway.
I showed the possible direction ;)
yes .... but the timing is more complicated than that.
I realized that my idea is wrong. I have to find another way

tank you
And it would fail if FTP server and ScriptFTP does not have the same local time.
There is a proposal to use in GETFILETIME command SETCLOCKDIFF value. Or maybe do new command GETCLOCKDIFF to use as you'd like...