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:
41,276
Location:
Prague, Czechia

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

First, you should read:

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
Joined:
Posts:
10

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

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

Advertisement

millerintllc
Joined:
Posts:
2

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

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

Advertisement

You can post new topics in this forum