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

FTP

1 view
Skip to first unread message

The Hallam's

unread,
Aug 3, 2000, 3:00:00 AM8/3/00
to
Hi, I asked along time ago, but forgot

I have to upload the same files about once a week, after I change them...I
want to know how to tell the ftp exe program of mine (in Windows) to receive
a text document of the commands, and follow them...can you help?

Andreas Meile

unread,
Aug 3, 2000, 3:00:00 AM8/3/00
to
"The Hallam's" <hal...@amtelecom.net> schrieb im Newsbeitrag
news:#o7BbKX$$GA....@cppssbbsa02.microsoft.com...

You posted this question to a *BASIC* newsgroup for *DOS* so I give you an
answer for QuickBASIC (QBASIC.EXE already works fine) here:

' Perform an FTP call in BASIC

INPUT "Host name"; h$
INPUT "User name"; u$
PRINT "Password";
COLOR 0, 0 ' use hidden input. You can write your own more luxurious SUB
routine of course... :-)
INPUT p$
COLOR 7, 0
INPUT "Local directory"; ld$
INPUT "Remote directory"; rd$
INPUT "Remote file name"; rf$

tp$ = ENVIRON$("TEMP")
IF tp$ = "" THEN
PRINT "Make sure that your TEMP environment variable has been"
PRINT "set. Add a line SET TEMP=C:\TEMP to your AUTOEXEC.BAT"
SYSTEM
END IF
IF RIGHT$(tp$, 1) <> "\" THEN
tp$ = tp$ + "\"
END IF
' Create an *unique* temporary file name, so this program can
' simultaneously run multiple times without conflicts
' See http://dreael.catty.ch/Deutsch/BASIC-Knowhow-Ecke/EinbettungBSY.html
for more details
tp$ = tp$ + "~"
FOR I% = 1 TO 3
tp$ = tp$ + CHR$(65 + CINT(INT(26! * RND)))
NEXT I%
tp$ = tp$ + MID$(TIME$, 4, 2) + RIGHT$(TIME$, 2) + ".TMP"

' create a file with FTP commands
OPEN tp$ FOR OUTPUT AS 1
PRINT #1, "user "; u$; " "; p$
PRINT #1, "bin" ' You also can use "asc" instead "bin" for text files
PRINT #1, "cd "; rd$
PRINT #1, "lcd "; ld$
PRINT #1, "get "; rf$
PRINT #1, "bye"
CLOSE 1

' Execute FTP command: This works like in UNIX and Linux :-)
SHELL "ftp -n " + h$ + " <" + tp$

' delete temporary file
KILL tp$

END

I hope this satisfies you. :-) If you intend to write a .BAT file, please
post your question to the news:alt.msdos.batch newsgroup.

Andreas

Andreas Meile

unread,
Aug 3, 2000, 3:00:00 AM8/3/00
to
"Andreas Meile" <and...@hofen.ch> schrieb im Newsbeitrag
news:8mcj2f$hdl$2...@news1.sunrise.ch...

> PRINT #1, "get "; rf$
Use PRINT#1, "put" for transfer away instead of "get".

Andreas

mla...@hotmail.com

unread,
Aug 4, 2000, 3:00:00 AM8/4/00
to
The Hallam's wrote:
>
> Hi, I asked along time ago, but forgot
>
> I have to upload the same files about once a week, after I change them...I
> want to know how to tell the ftp exe program of mine (in Windows) to receive
> a text document of the commands, and follow them...can you help?

Create a text file with this in it:

open ftp.site.com
username
[note it does not accept a password from a file]
[you can write your upload commands here]

save the file as, for example, ftp.txt; to save some typing time, create
a batch file and write this:

ftp.exe<ftp.txt

save the batch file as weekftp.bat and run it anytime you want.


Michael

0 new messages