Keepuptodate pushing files from starting my script

Advertisement

chandra07.java@gmail.com
Joined:
Posts:
1
Location:
hyderabad

Keepuptodate pushing files from starting my script

SourceDirectory=E:\Local\winscpdata
SFTPUserName=*****
SFTPPassword=***
SFTPIP=*****
SFTPFolderLocation=sftpsync
HostKey=*******

---SFTPSynch File---
@echo off
for /f "tokens=1,2 delims==" %%a in (config.txt) do (
if %%a==SourceDirectory set SourceDirectory=%%b
if %%a==SFTPUserName set SFTPUserName=%%b
if %%a==SFTPPassword set SFTPPassword=%%b
if %%a==SFTPIP set SFTPIP=%%b
if %%a==SFTPFolderLocation set SFTPFolderLocation=%%b
if %%a==HostKey set HostKey=%%b
)
 
echo %SourceDirectory%
echo %SFTPUserName%
echo %SFTPPassword%
echo %SFTPIP%
echo %SFTPFolderLocation%
echo %HostKey%
 
winscp.com /ini=nul /script=winscpsynch /parameter %SourceDirectory% %SFTPUserName% %SFTPPassword% %SFTPIP% %SFTPFolderLocation% %HostKey%
 
pause
---winscpsynch file----------------
echo Starting WinSCP Utility
echo %1%
echo %2%
echo %3%
echo %4%
echo %5%
echo %6%
open sftp://%2%:%3%@%4%/ -hostkey=%6%
echo %TIMESTAMP#yyyy-mm-dd[ hh:mm[:ss]]%
# synchronize first time
synchronize remote %1% %5%
# run keepuptodate
keepuptodate %1% %5% -filemask="*>=%TIMESTAMP#yyyy-mm-dd[ hh:mm[:ss]]%"
exit
Use Case:
The script failed the below use case.
If I delete or move files to another folder, it will recreate the newly generated file. These are the steps to reproduce:
Create a folder with a file named 1.
Run you sync script. You should see 1 in the SFTP folder.
Add a new file locally and name it 2.
The file will be synced to SFTP.
Create a new folder in the SFTP call it archive.
Move 1 and 2 in the SFTP to the archive folder.
Add a new file locally call it 3.
Now you'll see 2 files in the SFTP, 2 and 3.
Expected result: only 3 should be synced as 2 had been synced already.

Root Cause : I am passing TIMESTAMP at starting of Keep uptodate i..e it pushes files from that time.How can we update the time to current time?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,468
Location:
Prague, Czechia

Re: Keepuptodate pushing files from starting my script

It should be -filemask="*>=%TIMESTAMP#yyyy-mm-dd hh:mm:ss%" – no brackets.
Alternatively, this might be a better solution: -filemask="*>=+0S"

Reply with quote

Advertisement

You can post new topics in this forum