Topic "Auto Download Sync"

Author Message
Craig

Guest


First time WinSCP user, sorry for my basicness- We're working with a vendor which is amassing Terabytes of data on an FTP server and we wish to set up an automated process which logs in and downloads only new data added on the remote side to our local storage server.

I got WinSCP installed, created my bat and txt files, can get it to log in run on a schedule, but using
synchronize local L:\Local\testDIR /remote/testDIR/
and watching it I can see that it is not only transferring the new files there, but is also transferring files which were already downloaded to the test directory. How can I get it to go about only downloading the new files, and how can I create a log file to list newly copied files?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Craig wrote:
How can I get it to go about only downloading the new files

That's a default behavior.
See FAQ if you have problems:
https://winscp.net/eng/docs/faq_synchronize

Quote:
and how can I create a log file to list newly copied files?

You can use XML logging:
https://winscp.net/eng/docs/logging_xml
_________________
Martin Prikryl
aliriza

Guest


make a file call it winscpscript.txt and drop next in:
-----------------------------------------------------------
option batch continue
option confirm off
open K2Fexport
synchronize local C:\Centric\Readsoft\Data\Masterdata\Doel /K2FExportXML/Doel/
exit
----------------------------------------------------------------------------------

next make another file call it winscpscript.cmd and drop next in:


"C:\Program Files (x86)\WinSCP\WinSCP.exe" /script=C:\Centric\Winscp_Opstart_Scripts\WinscpScript.txt /log=c:\temp\k2fexport.log

oke then make from windows scheduled task to batch file and you are done:-))
cdannenberg
[View user's profile]

Joined: 2014-06-09
Posts: 5
Location: Kansas
Thank you Aliriza, that was very helpful! I was very confused initially as it wanted to copy all the files previously copied, using synchronize shouldn't do that... For the initial download the vendor sent a hard drive to us and those files were placed on the server, and for one reason or another, when the script runs it replaces all the files (but on resulting syncs after that it does not). It will take a bit to get caught up in resynchronizing them and piddles on that whole shortcut get them from a drive initially, but if it works it work- I'm happy. So thanks!

Logging: I have my .cmd file in place now with the path changed a bit; my original .bat file is:
@echo off
winscp.com /script=test.txt
How should I change it so the .bat triggers WinSCP to run the script, and the .cmd file to log what it's doing?
cdannenberg
[View user's profile]

Joined: 2014-06-09
Posts: 5
Location: Kansas
Now I see that the .cmd file was really to replace the .bat. I'm not sure why, but when run from the .bat the synchronization takes place, and when I run the .cmd file the command prompt opens and closes without an action being taken. Is there a way to trigger the logging from the .bat file?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
cdannenberg wrote:
Now I see that the .cmd file was really to replace the .bat. I'm not sure why, but when run from the .bat the synchronization takes place, and when I run the .cmd file the command prompt opens and closes without an action being taken. Is there a way to trigger the logging from the .bat file?

There's (virtually) no difference between .cmd and .bat:
http://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd

For logging use /log (what is actually used already in the example by @aliriza above).

Though I would suggest you to use winscp.com than winscp.exe. It reuses current console window, what allows you to spot any fatal error (that may prevented logging from even starting) more easily.
See https://winscp.net/eng/docs/executables

Last edited by martin on 2014-07-28; edited 1 time in total
cdannenberg
[View user's profile]

Joined: 2014-06-09
Posts: 5
Location: Kansas
Thanks Martin,
I fiddled more- switched my previously working .bat to .cmd, that worked, and per your recommendation looked back at Aliriza's log script, in my working .bat I was using winscp.com- I simplified it down to just:

winscp.com /script=test.txt /log=WinSCP.log

did the trick, it synchronized the test directory in test.txt and created the log successfully.
Thanks for all the time you've spent working on WinSCP.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License