Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP

Status
Not open for further replies.

Nozy

Technical User
Jun 13, 2001
49
GB
Greetings all.

Please could anyone help, Newbee to VB having trouble with this peace of code. The problem is that I am unabe to get file from remote server. This code works the only problem is that I am unable to work out how to get a file. How would I express the first line to point to remote server.

* For Each fil in filc
* if right(fil.name,3) = "cdr" THEN
* f_out.writeline("get " & fil.name)
* END if
* Next
* Count = Count + 1


const root = "D:\ivr\FTP\ToVertex"
const scriptnam = "D:\ivr\FTP\WHS\msgup.ftp"
const ftplog = "D:\ivr\FTP\WHS\ftp.log"

Dim server(5)
Dim Count

Server(0) = "RETBOLTSIVRV1"
Server(1) = "RETBOLTSIVRV2"
Server(2) = "RETRAYLSIVRV1"
Server(3) = "RETRAYLSIVRV2"
Server(4) = "RETBEDFSIVRV1"
Server(5) = "RETBEDFSIVRV2"

Count = 0

set fs = CreateObject("Scripting.FileSystemObject")
set f_log = fs.OpenTextFile(ftplog,8,TRUE) ' Open in append mode
f_log.writeline("")
f_log.writeline("=============================")
f_log.writeline("New ftp session " & now())
f_log.writeline("=============================")
f_log.close

set startfolder = fs.GetFolder(root)
set filc = startfolder.Files
set f_out = fs.CreateTextFile(scriptnam,TRUE)

f_out.writeline("open Server")
f_out.writeline("user user password")
f_out.writeline("lcd d:\ivr\FTP\FromVertex")
Do Until count = 5
f_out.writeline("cd /home/ivrftp/FromVertex/" & server(Count))
For Each fil in filc
if right(fil.name,3) = "cdr" THEN
f_out.writeline("get " & fil.name)
END if
Next
Count = Count + 1
Loop
f_out.writeline("close")
f_out.writeline("bye")
f_out.Close
 
You aren't using FTP in the correct way here. Look at the Internet Transer Control set to the FTP protocol in order to create an FTP session.

You need to give it your url, username and password.

You then need to use statechanged to report the state of the connection, and use getchunk to get a chunk of data from your target url (the file you want to download)


Good Luck

VBrit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top