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

martin

You put the /log on the WinSCP commandline. Just as you have it in your very first post.
The target folder must exists. The path must a be full file path, not just the target directory. Again, just as you have it in your first post. Though there you obviously have problem with C:\Program Files (x86) not being a writable folder. You have to point WinSCP to a folder, where you have write permissions to. The extension does not really matter (it just cannot be .xml).
jland47

Do you put the /log command in the bat or text file? Do you create a folder for it or do you just point to which drive you want it to go to ex. C:\DOCUMENTS\? What type of file extension is it, the example I was looking at had a .log extension is this correct?
martin

So what is unclear about the logging?
jland47

I got my scripts to work the bat script
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=C:\Users\jarett.AS\Documents\lapcosync.txt


With the text script
option batch abort
option confirm off
open ftp://user:pass!@ip/ -passive=off
synchronize remote "O:\Purchase Orders\z-POs\Automated_PO\Lapco_PO" /Action
exit


I am still confused on the log part, I've read the section on logging but it's not clicking in my head.
martin

You need to log to a folder, where you have write permissions. So definitely not to the Program Files.

I've now notices that you have the synchronize command wrong. It should be like:
   "synchronize remote ""O:\Purchase Orders\z-POs\Automated_PO\Lapco_PO\PO_*"" /Action" ^

See https://winscp.net/eng/docs/commandline#syntax
jland47

Should something be in front of the code? When I run it as a .bat the whole first section of code looks like it is just printed on the command screen and is not "doing" anything. After the first "exit" command I get these lines of code;
Error occurred during logging. It's been turned off.

Can't open log file 'C:\Program Files (x86)\WinSCP\test\winscp.log'.
System Error.  Code: 5.
Access is denied
Connecting to ###.###.##.### ...
Connected
Starting the session...
Session started.
Active session: [1] user@###.###.##.###

Then this is the last part
C:\Users\jarett.AS\Documents>set WINSCP_RESULT=1


C:\Users\jarett.AS\Documents>if 1 EQU 0 (echo Success )  else (echo Error )
Erro
jland47

Synchronizing local folder script

Been reading multiple post on this topic and still not 100% on how to go about this. I copied this script from another post. Do I just save this as a .bat and I can run it? Ultimate goal is to be able to schedule the script through task scheduler to run at a set time each day. The next hurdle is the script, does this look ok? I don't know if I have the /log statement correct, does this just create a log, do I really need it?
"C:\Program Files (x86)\WinSCP\winscp.com" /log="C:\Program Files (x86)\WinSCP\test\winscp.log" /command ^
   "option batch abort" ^"open ftp://user@###.###.##.###:password@###.###.##.###/Action" ^
   "synchronize remote "O:\Purchase Orders\z-POs\Automated_PO\Lapco_PO\PO_*" /Action" ^
   "exit"
pause