• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Need help with ftp script

T

Toni

Flightless Bird
I'm trying to create a WinXP ftp script and I'm having a hard time even figuring out the
syntax.

I have an XML file on one of my websites, let's call it sourceweb.com (publicly
available) that I want to copy to a directory on another of my websites, let's call it
destinationweb.com, so that it overwrites the existing file.

I'd like the script to include the destination's ftp user name & prompt me for the
password.

Can anyone please show me how to do this?

Thanks!!!
 
P

Pegasus [MVP]

Flightless Bird
"Toni" <Toni@nowhere.com> wrote in message
news:-OOmjkDF8KHA.1888@TK2MSFTNGP05.phx.gbl...
> I'm trying to create a WinXP ftp script and I'm having a hard time even
> figuring out the syntax.
>
> I have an XML file on one of my websites, let's call it sourceweb.com
> (publicly available) that I want to copy to a directory on another of my
> websites, let's call it destinationweb.com, so that it overwrites the
> existing file.
>
> I'd like the script to include the destination's ftp user name & prompt me
> for the password.
>
> Can anyone please show me how to do this?
>
> Thanks!!!


Here you go. Note that the password entry screen offers no security.

[01] @echo off
[02] goto start
[03] --------------------------------------------
[04] Copy some file from one web site to another.
[05] 10.5.2010 FNL
[06] --------------------------------------------
[07] :start
[08] set script="%temp%\script.scr"
[09] set sSite=ftp.quicklink.com
[10] set tSite=ftp.slowlink.com
[11] set sFolder=public_html/Tools
[12] set tFolder=
[13] set account=JoeDoe
[14] set password=
[15] set File=rdir.vbs
[16]
[17] set /p password=PW?
[18] call :Get
[19] call :put
[20] set password=
[21] del %script%
[22] goto :eof
[23]
[24] ---------------------------
[25] Download the specified file
[26] ---------------------------
[27] :Get
[28] echo> %script% %account%
[29] echo>>%script% %password%
[30] if not "%sFolder%"=="" echo>>%script% cd "%sFolder%"
[31] echo>>%script% binary
[32] echo>>%script% get "%File%"
[33] echo>>%script% quit
[34] ftp -s:%Script% %SSite%
[35] goto :eof
[36]
[37] -------------------------
[38] Upload the specified file
[39] -------------------------
[40] :put
[41] echo> %script% %account%
[42] echo>>%script% %password%
[43] if not "%sFolder%"=="" echo>>%script% cd "%sFolder%"
[44] echo>>%script% binary
[45] echo>>%script% put "%File%"
[46] echo>>%script% quit
[47] ftp -s:%Script% %SSite%
 
T

Toni

Flightless Bird
Wow - THANKS!

"Pegasus [MVP]" wrote...
>
> Here you go. Note that the password entry screen offers no security.
>


What if my destination server has FTPS? How would that change your script?
 
P

Pegasus [MVP]

Flightless Bird
"Toni" <Toni@nowhere.com> wrote in message
news:-OXcR4WF8KHA.5808@TK2MSFTNGP02.phx.gbl...
> Wow - THANKS!
>
> "Pegasus [MVP]" wrote...
>>
>> Here you go. Note that the password entry screen offers no security.
>>

>
> What if my destination server has FTPS? How would that change your script?
>


Sorry, I've never played with ftps. You will have to work out the
differences and adjust the code accordingly. Since it is highly modular,
this should be a trivial matter.
 
Top