WINSCP Batch file error pushing file to SFTP

Advertisement

SgtRock63
Joined:
Posts:
1
Location:
Wausau

WINSCP Batch file error pushing file to SFTP

First - Not a programmer by any means, however, I have been able to grab a file via WINSCP SFTP to a third party server/system. I was then asked to create the same by pushing a file. AS in the working case I created a Batch file to call a text file to pull the file in. after some serious tweaking, I got this to work.

Now in the new scenario, I re-created the same batch/text file and added the needed commands based on what I read and this is creating and error that I cannot resolve. I know the directory has the necessary permissions as I can perform the task manually without issue via WINSCP. I am guessing it is the code - not sure - HELP!

Batch:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@echo off
REM Next line NOT needed if you add the WinSCP folder to your Windows
REM PATH environment variable
CD "C:\Program Files (x86)\WinSCP"
Winscp.com /script=C:\Scripts\SFTP_FILENAME.txt
pause (ADDED FOR TROUBLESHOOTING)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(TEXT FILE BEING CALLED)

option echo off
option batch on
option confirm off
open sftp://USERID:PASSWORD@sftp.COMPANY.com
put -delete -nopreservetime -nopermissions E:\SFTP_Test\*.pdf /*
exit

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See attached for error -

WINSCP SFTP Error 1.jpg

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: WINSCP Batch file error pushing file to SFTP

Can you upload the file in WinSCP GUI? Or in any other SFTP client? If you can, please post a log file showing that.

And also attach a full session log file from your WinSCP script.

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum