Solved

problem in ftp-download using wininet.dll

Posted on 2003-11-10
1
608 Views
Last Modified: 2008-03-10
Hi,

I am using wininet.dll APIs to download and upload files from ftp server.
the APIs I am using are as follows :

Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long

Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hFtpSession As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Long

Now I want to download the files using Partial name like "somefile*.xml"
These APIs does not seem to work. Can anyone advice me on how to do it.
Please reply asap. Its very urgent.

Kirti
0
Comment
Question by:kirtirani
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 200 total points
Comment Utility
You can only get one file with FtpGetFile.

What you have to do is pass "somefile*.xml" to FtpFindFirstFile() and InternetFindNextFile() to get a directory listing matching your file pattern.  Then use FtpGetFile on each file in the list you got back.

Here is a link to the FtpFindFirstFile() function.  On the bottom of the page is a link to an example of how to use it.

http://www.mentalis.org/apilist/FtpFindFirstFile.shtml

Regards,

Idle_Mind
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now