How can I convert my windows scripts to winSCP scripts

Advertisement

Arvada Joe
Joined:
Posts:
2

How can I convert my windows scripts to winSCP scripts

Hi folks,

I am brand new to WinSCP. I need to send multiple files to a remote site in a secure ftp. Here are what my current scripts look like:


RUN.BAT

@echo off
REM ------------------------------------------
REM This batch file will run an ftp upload
REM then delete files on the current computer.
REM ------------------------------------------
REM Start the upload
echo ----------------------------------
echo Start uploading at %TIME%
echo ----------------------------------
ftp -s:putfile.txt XXX.XX.XXX.XXX //runs the text file below
REM Done uploading, now delete the files on the local machine
echo ----------------------------------
echo Deleting local files
echo ----------------------------------
del D:\FTP_FOLDER\III to DOR\hello*.txt // deletes the files on my side after the ftp
REM copy over the files on the root to replace the one's just deleted
echo ----------------------------------
copy D:\helloworld*.txt
echo ----------------------------------
echo Upload complete at %TIME%.
echo ----------------------------------

KICKS OFF THIS FILE:

PUTFILE.TXT

jdoe // user name
jdoe // password
prompt
cd uploads
mput helloworld*.txt /files to be trasferred
bye

Thanks!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: How can I convert my windows scripts to winSCP scripts

First, you should read
https://winscp.net/eng/docs/guide_automation

But, anyway:

RUN.BAT

...
echo ----------------------------------
echo Start uploading at %TIME%
echo ----------------------------------
winscp.com /script=putfile.txt
REM Done uploading, now delete the files on the local machine
...

PUTFILE.TXT

option batch on
option confirm off
open sftp://jdoe:jdoe@XXX.XX.XXX.XXX
cd uploads
put helloworld*.txt
exit

Reply with quote

Inkster jim

Re: How can I convert my windows scripts to winSCP scripts

Hi Prikryl,

When I reply I dont see an empty box and I can't add to the stream by typing at the bottom of your post. So I just deleted what was in there and started from the top again, is this right.

Reply with quote

Inkster jim
Joined:
Posts:
11

Re: How can I convert my windows scripts to winSCP scripts

Hi Prikryl

When I ran the code you gave me I got a "winSCP is not a valid win32 application"

I also got a "access denied"

Is there a certain location I need to run the batch files from?
Right now the files are 4 layers down. Does it have to be run with the path ie c:\program files\WinSCP script?

Can you give me a step by step process of how I need to do this.
Is a session necessary to do this like it is within the application?

To run the 'run.bat' before I just typed bat. Is that what I do here?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: How can I convert my windows scripts to winSCP scripts

As these probable are not WinSCP specific, you should better ask someone who can see the problem on your screen. This way we could hardly solve anything. I'm sorry.

Reply with quote

millerintllc
Joined:
Posts:
2

Re: How can I convert my windows scripts to winSCP scripts

martin wrote:

As these probable are not WinSCP specific, you should better ask someone who can see the problem on your screen. This way we could hardly solve anything. I'm sorry.

I also got the same error after running that code. Now WinSCP.com doesn't seem to work. I would like to reinstall but I'm afraid it may lose my saved connections if I do so?

Reply with quote

martin
Site Admin
martin avatar

Re: How can I convert my windows scripts to winSCP scripts

millerintllc wrote:

I also got the same error after running that code. Now WinSCP.com doesn't seem to work. I would like to reinstall but I'm afraid it may lose my saved connections if I do so?
You won't lose your settings, if you reinstall.

Reply with quote

Advertisement

You can post new topics in this forum