Topic "How can I convert my windows scripts to winSCP scripts"

Author Message
Arvada Joe
[View user's profile]

Joined: 2011-05-23
Posts: 2
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!
Advertisements
Inkster jim
[View user's profile]

Joined: 2011-05-23
Posts: 11
Is this specifically WinSCP script or SFTP maybe
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
First, you should read
http://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
Inkster jim
[View user's profile]

Joined: 2011-05-23
Posts: 11
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.
Inkster jim
[View user's profile]

Joined: 2011-05-23
Posts: 11
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License