Hi,
I am new to WINSCP, please help.
I have a script for uploading a file, then use a batch file to run that script. The batch file also archive the file locally if uploading is successful, or put the file into a failed folder if uploading is failed.
Both the script.txt and the batch file are under the WINSCP directory, and when double click the batch file, it runs successfully.
I also have a C# Windows form application, when a button is clicked the batch file will be invoked to upload that file too. I don't know why, but the file always end up failed to upload, and goes to the failed folder. It tells me that the batch file is executed, just the uploading using WINSCP failed. I attched the script, batch, and part of the code below:
C# code: System.Diagnostics.Process.Start(batPath);//batPath is @"C:\PROGRA~1\WINSCP\TNDOS.bat"
Script.txt:
option batch abort
option confirm off
# open stored session
open TNStateUpload
put E:\Export\TNDOT\*.*
close
exit
Batch file:
winscp.com /script=script.txt
if errorlevel 1 goto error
echo Upload succeeded, moving local files
move E:\Export\TNDOT\*.* E:\Export\Archive\
goto end
:error
echo Upload failed, moving local files
move E:\Export\TNDOT\*.* E:\Export\Failed\
:end
I will be waiting for answers, thanks to everyone takes time to read this post and trying to help.
Thanks!!!