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

Please attach a log file.
paslechoix

martin wrote:

It's obvious that the batch file is wrong. You have the ^'s wrong. I do not know how else to tell you, to help you to get them right.

Maybe it's time to give up and put everything to a single line:

"C:\WinSCP\WinSCP.com" /log="C:\writable\path\to\log\WinSCP.log" /ini=nul /command "open ftpes://ftpuser:password@sftp.mysite.com/" "synchronize remote \Temp /Distribution/Comp" "exit"

Though the first "The File name, directory name, or volume label syntax is incorrect" error suggests, you might have yet another problem there. I cannot help you with that, if you do not show us the command. You can mask out the sensitive parts. Though, the less information you mask out, the more likely we will be able to help you.


Thank you, your script is partly working with a different error:

Error listing directory '/Distribution/TheFolder'
Error retrieving file list for '/Distribution/TheFolder\*.*'
System Error. Code: 3.

How can I fix it?

Thanks lots.
martin

It's obvious that the batch file is wrong. You have the ^'s wrong. I do not know how else to tell you, to help you to get them right.

Maybe it's time to give up and put everything to a single line:

"C:\WinSCP\WinSCP.com" /log="C:\writable\path\to\log\WinSCP.log" /ini=nul /command "open ftpes://ftpuser:password@sftp.mysite.com/" "synchronize remote \Temp /Distribution/Comp" "exit"

Though the first "The File name, directory name, or volume label syntax is incorrect" error suggests, you might have yet another problem there. I cannot help you with that, if you do not show us the command. You can mask out the sensitive parts. Though, the less information you mask out, the more likely we will be able to help you.
paslechoix

martin wrote:

Anonymous wrote:

I made some modification to the .bat script but still not working:

"C:\WinSCP\WinSCP.exe /log="C:\SFTP\log\t4log_!Y_!M_!D_!T.log" /loglevel=0 /ini=nul /command open ftpes://ftpuser:password@sftp.mysite.com/ ^

That's a wrong syntax.
And stick with the winscp.com. Do not use winscp.exe in a batch file.


Thank you.

I modified the .exe to .com, it still shows error on the first line and there after.

Please see the screenshot (I'm sorry the first line contains confidential info and is hence excluded from the screenshot but it is like:
C:\WinSCP\WinSCP.com /log="C:\SFTP\log\t4log_!Y_!M_!D_!T.log" /loglevel=0 /ini=nul /command open ftpes://ftpuser:password@sftp.mysite.com/

Thank you
martin

Anonymous wrote:

I made some modification to the .bat script but still not working:

"C:\WinSCP\WinSCP.exe /log="C:\SFTP\log\t4log_!Y_!M_!D_!T.log" /loglevel=0 /ini=nul /command open ftpes://ftpuser:password@sftp.mysite.com/ ^

That's a wrong syntax.
And stick with the winscp.com. Do not use winscp.exe in a batch file.
martin

paslechoix wrote:

Thank you. I ran it from command line and it prompts the first line is not a recognized command:
"open ftpes://ftpuser:password@sftp.mysite.com/" ^

Show us a screenshot! Make sure there's no echo off command in the batch file.
Guest

paslechoix wrote:

martin wrote:

There has to be some error message. What do you see in the console, when you execute the batch file? Make sure you execute the batch file in console. Not by double-clicking it in Windows Explorer.


Thank you. I ran it from command line and it prompts the first line is not a recognized command:
"open ftpes://ftpuser:password@sftp.mysite.com/" ^

Thank you


I made some modification to the .bat script but still not working:

"C:\WinSCP\WinSCP.exe /log="C:\SFTP\log\t4log_!Y_!M_!D_!T.log" /loglevel=0 /ini=nul /command open ftpes://ftpuser:password@sftp.mysite.com/ ^

Thanks.
paslechoix

martin wrote:

There has to be some error message. What do you see in the console, when you execute the batch file? Make sure you execute the batch file in console. Not by double-clicking it in Windows Explorer.


Thank you. I ran it from command line and it prompts the first line is not a recognized command:
"open ftpes://ftpuser:password@sftp.mysite.com/" ^

Thank you
martin

There has to be some error message. What do you see in the console, when you execute the batch file? Make sure you execute the batch file in console. Not by double-clicking it in Windows Explorer.
paslechoix

Thank you.

I removed all spaces after the symbol ^

I ran it again and this time even the WinSCP was not brought up, therefore there is no log I can provide you.

I confirmed by manually started WinSCP and was able to connect, so there is problem with WinSCP.
paslechoix

My script of auto sync is not working

Hello,

This is what I did:
1. Get connected with the server
2. Go to Session, click on Generate Session URL/Code
3. Under the Script tab, select Batch file as the Format, save it to autosync.bat
4. Using a text editor, replace "Your command 1" with:
"synchronize local \Temp /Distribution/Comp1"
run the bat

Nothing copied to a new empty folder C:\Temp

From the log I can see the connection was set up and the directory was pull out. The last a few lines are:
. 2016-11-14 14:02:52.884 Startup conversation with host finished.
. 2016-11-14 14:03:22.525 Sending dummy command to keep session alive.
> 2016-11-14 14:03:22.525 PWD
< 2016-11-14 14:03:22.525 257 "/Distribution/Comp" is current directory
. 2016-11-14 14:03:51.820 Disconnected from server

My script ends up as below:
@echo off


"C:\WinSCP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open ftpes://ftpuser:password@sftp.mysite.com/" ^
    "synchronize remote \Temp /Distribution/Comp" ^
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%


Can anyone help me to fix it please? Thank you very much.