Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

cdannenberg

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.
martin

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:
https://stackoverflow.com/q/148968/850848

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
cdannenberg

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?
cdannenberg

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?
aliriza

script syncronize from unix to windows 2008 local directory

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:-))
Craig

Auto Download Sync

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?