Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simple FTP script

0 views
Skip to first unread message

scott

unread,
Oct 17, 2003, 3:32:00 PM10/17/03
to
Hi,

I often need to upload single files to an FTP server.

I am trying to create a script that will automate this process, and have
been investigating VBScript to do this job.

I know a little about FTP.exe with the -s: tag to make it run scripts.

Ideally what I would like is for the script to open a box where I could drag
the file, and from there it would upload it.

So structurally, the process goes: Create a variable, set this variable to
contain the file directory\name, then it would create the script to enter
into FTP.exe, and run it.

Can anyone give me any hints on the best way to go about it? I'd be most
grateful.
Scott


Ray at <%=sLocation%>

unread,
Oct 17, 2003, 3:41:20 PM10/17/03
to
There isn't really any gui interaction with vbscript scripts aside from
msgboxes and inputboxes and stuff. But maybe something you'd be interested
in is adding a right click option in Windows Explorer that would execute an
ftp script. Yes/no?

Ray at work

"scott" <vote...@cathsDOTco.uk> wrote in message
news:vp0gtjp...@corp.supernews.com...

scott

unread,
Oct 17, 2003, 4:10:14 PM10/17/03
to

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:#4zfkaOl...@TK2MSFTNGP10.phx.gbl...

> There isn't really any gui interaction with vbscript scripts aside from
> msgboxes and inputboxes and stuff. But maybe something you'd be
interested
> in is adding a right click option in Windows Explorer that would execute
an
> ftp script. Yes/no?

Actually, that would be perfect. I couldn't think of a way to get the name
of the file that I wanted to send into the script though....


Ray at <%=sLocation%>

unread,
Oct 17, 2003, 4:29:08 PM10/17/03
to
Here's a quick and dirty .bat way of doing it. Filename =
D:\Windows\ftpit.bat

@echo off
set f="%*"
@echo Generating FTP session...
@echo open XXX.XXX.XXX.XXX>c:\up.ftp
@echo user USERNAME>>c:\up.ftp
@echo PASSWORD>>c:\up.ftp
@echo type ascii>>c:\up.ftp
@echo put %f%>>c:\up.ftp
@echo close>>c:\up.ftp
@echo quit>>c:\up.ftp
@echo Connection to FTP Server
ftp.exe -v -n -s:C:\up.ftp
@echo fine


Then merge in a .reg file with these contents:


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]

[HKEY_CLASSES_ROOT\*\shell\uploadMe]

[HKEY_CLASSES_ROOT\*\shell\uploadMe\command]
@="D:\\WINDOWS\\ftpit.bat \"%1\""

Note that this is for if you have a ftpit.bat file in D:\Windows. Adjust as
needed. Also, I guess to handle ascii vs. binary file transfer (or image
type for some hosts), I'm not sure what you'd do. You could have a right
click option for each transfer type, or you could have it decided based on
known file extensions, and if uknown, default to binary.

Ray at work

"scott" <vote...@cathsDOTco.uk> wrote in message

news:vp0j59m...@corp.supernews.com...

scott

unread,
Oct 17, 2003, 5:08:48 PM10/17/03
to

Ray, you are a god damn magician...

Works a treat I must say :-). Thank you!

Only had to change one thing:

> set f="%*"

Had to take the brackets off "%*", as it was failing to upload double
bracketed files.

Other than that, work of mastery, thanks!! :-)

Scott.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message

news:OqUVS1Ol...@TK2MSFTNGP11.phx.gbl...

Ray at <%=sLocation%>

unread,
Oct 17, 2003, 5:13:51 PM10/17/03
to
Hey, thanks! I'm sure you'll have to tweak as you go, but at least you're
started.

Ray at work

"scott" <vote...@cathsDOTco.uk> wrote in message

news:vp0mj47...@corp.supernews.com...

Bill James

unread,
Oct 17, 2003, 8:43:14 PM10/17/03
to
You might be interested in looking at the script I have for this on my VBScript page. To simplify things, the local directory structure must exactly match the server directory structure, but if you can live with that it works very well with a shortcut in the SendTo folder.

--

Bill James
Microsoft MVP - Shell/User

Win9x VBScript Utilities » www.billsway.com/vbspage/
Windows Tweaks & Tips » www.billsway.com/notes_public/

"scott" <vote...@cathsDOTco.uk> wrote in message news:vp0gtjp...@corp.supernews.com...

0 new messages