Hello,
I just downloaded your program and am trying to use the SYNC command to update files ONLY if they are newer on the Remote Side and NOT the local side.
The example below works exactly as I want but it only sync's if the Local side has newer files:
Is this something that is possible with ScriptFTP?
Thanks for your help,
--Duane
I just downloaded your program and am trying to use the SYNC command to update files ONLY if they are newer on the Remote Side and NOT the local side.
The example below works exactly as I want but it only sync's if the Local side has newer files:
Code: Select all
Basically, I want to SYNC only if the Remote Side has changed the content.SYNC("c:\domain\domain_backup","domain.net",UPLOAD_DELETE, SUBDIRS)
Is this something that is possible with ScriptFTP?
Thanks for your help,
--Duane
Hi,
As the SYNC criteria is the opposite, I think that the only solution is to compare local and remote file sizes with GETFILESIZE. If they are different, upload the file. The problem with this solution is that you cannot go through subdirectories. It would be something like this:
As the SYNC criteria is the opposite, I think that the only solution is to compare local and remote file sizes with GETFILESIZE. If they are different, upload the file. The problem with this solution is that you cannot go through subdirectories. It would be something like this:
Code: Select all
If you need a more detailed example or any further questions feel free to post here again.GETLIST($fileList,REMOTE_FILES)
FOREACH $fileName IN $fileList
$remoteFileSize = GETFILESIZE(REMOTE, $fileName)
$localFileSize = GETFILESIZE(LOCAL, $fileName)
IF($remoteFileSize != $localFileSize)
PUTFILE($fileName)
END IF
END FOREACH
liked Script FTP? Try our other product Email Parser
Hello,
If I may say, the script would be better if a double check were made on the files, like as follows:
HTH
Zythan
If I may say, the script would be better if a double check were made on the files, like as follows:
Code: Select all
This would make sure that files that have changed content but not size have been synchronised.GETLIST($fileList,REMOTE_FILES)
FOREACH $fileName IN $fileList
$remoteFileSize = GETFILESIZE(REMOTE, $fileName)
$remoteFileTimeStamp = GETFILETIME(REMOTE, $fileName)
$localFileSize = GETFILESIZE(LOCAL, $fileName)
$localFileTimeStamp = GETFILETIME(LOCAL, $fileName)
IF($remoteFileSize != $localFileSize AND $remoteFileTimeStamp != $localFileTimeStamp)
PUTFILE($fileName)
END IF
END FOREACH
HTH
Zythan
Thanks Duane, you are right. But note that if the computer where ScriptFTP is running and the FTP server have different local times the file date will be always different.
liked Script FTP? Try our other product Email Parser
Hello,
The SETCLOCKDIFF command would then be of use, I presume.
Regards.
Zythan
The SETCLOCKDIFF command would then be of use, I presume.
Regards.
Zythan
MMmmm not, the clock time difference set with SETCLOCKDIFF is only applied when synchronizing files. If you request a file modification time to the FTP server with GETFILETIME the returned time is the one reported by the FTP server, the time difference is not applied.
I think I should consider changing this behavior.
I think I should consider changing this behavior.
liked Script FTP? Try our other product Email Parser
- All times are UTC -