Solved

problem in ftp-download using wininet.dll

Posted on 2003-11-10
1
609 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
ID: 9720050
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 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