p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

vb_websites_discuss thread: Downloading files from FTP site


Message #1 by n_ajayan@y... on Thu, 14 Feb 2002 12:32:55
Any easy way to do this is to create a small script that will login to the
server, go to the source directory on the FTP server, change the destination
directory of the receiving machine to the correct path, get the file and
close out.  Then shell the FTP command with the script.

The shell command is:
c:\windows\ftp -i -s:<FileName>

The script shoul look something like this.,

open <Server Name>
<User Name>
<PassWord>
'Change to 
lcd <Destination Drive and Path>
cd /<Source path on FTP Server>
mget (or Get)<File Name or wildcard *, *.TXT>
mdel (or Del)<File Name or wildcard *, *.TXT >
(The next two lines were just to change to the system directory and get a
file called alldone which the calling program used to exit the loop entered
to hold execution of the calling program until this script was done.  This
can be done more efficiently using the ShellAndWait API call in VB.)
cd /u/sysadm 
get alldone
quit


I would have the VB program create this script then use the API ShellAndWait
to shell the above command line.  I would also ensure I used either an API
call or some other logic to determine which path the ftp program was in,
Windows, WINNT, WIN, etc.

I hope this helps.  If you'd like a sample program feel free to ask or check
out:

http://www.planet-source-code.com/vb/

for more detailed examples of using winstock and other methods.  Just search
on FTP.  You should get a few decent examples.

I hope this helps.

Thanks

Crane Whitehead
Programmer / Analyst
cwhitehead@h...
xxx.xxx.xxxx
 
Healthaxis
Computing and Network services
http://www.healthaxisasg.com


 -----Original Message-----
From: 	n_ajayan@y... [mailto:n_ajayan@y...] 
Sent:	Thursday, February 14, 2002 6:33 AM
Subject:	Downloading files from FTP site

Hello to all,

I am developing a software which require automatic updation. Datas which 
should be updated are kept in a ftp site. Only thing I have to do is to 
copy the files from the ftp site to my system directory. Directory 
informations are stored in Registry.

Can anyone help in this.

Regards,
Ajay-------+---++----++-+---+----++----+---+----++-----+-----+--+-------++--

Subject: Re: MS Access reports through Visual Basic
From: n_ajayan@y...
Date: Thu, 14 Feb 2002 12:41:50
Reply-To: "Discuss VB Websites" <vb_websites_discuss@p...>

Dear Vijaya,

You know Crystal Reports? It is easier to create reports through Crystal 
Reports and have close association with Visual Basic. Or other wise, try 
to build report in Access itself and try access it through Visual Basic

Regards
Ajay
System Administrator
Trade Soft Technologies.

  Return to Index