Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FindFirstFile/FindNextFile/FindClose

Posted on 1999-07-12
8
Medium Priority
?
538 Views
Last Modified: 2013-12-03
FindFirstFile/FindNextFile/FindClose
How do I use these three functions or other functions to get the directories and files on a server. And how do I see them in the client ? What are the steps from getting the directories and files to sending and receiving and displaying on the client. A briefly explaination on the steps please. Some codes would be nice too.
0
Comment
Question by:redhat092798
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:redhat092798
ID: 1402755
Edited text of question.
0
 
LVL 4

Accepted Solution

by:
wylliker earned 50 total points
ID: 1402756
Pretty straight forward ...

// when looking at network file shares you will use UNC
// that looks like ... hard-coded example below

// Substitute COMPUTERNAME with a computer name from your
// network. Substitute Share with the name of a share on
// that computer!

char * UNCPath = "//COMPUTERNAME/Share/*.*";
HANDLE hFindFile = (HANDLE) NULL;
WIN32_FIND_DATA FindFileInfo;

hFindFile = FindFirstFile(UNCPath, &FindFileInfo);
if(hFindFile)
{
    do
    {
      // Here you can get ahold of any of the values of
      // the WIN32_FIND_DATA data structure
      // Read the help info on this structure to see what
      // info is available to you

      // Load up any controls - list boxes, list controls,
      // tree controls, combo boxes etc with the filename
      // or directory name, for example.

    } while(FindNextFile(hFindFile, &FindFileInfo);

    FindClose(hFindFile);
    hFindFile = (HANDLE) NULL;
}





0
 

Author Comment

by:redhat092798
ID: 1402757
I'm more interested on how and at which point do I send() to the client . And on the client side. How do I display this info in a listbox. Sorry for the slight turn in the question but I did ask for that in my original queston.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

Author Comment

by:redhat092798
ID: 1402758
I'm more interested on how and at which point do I send() to the client . And on the client side, how do I recv() and display this info in a listbox. Sorry for the slight turn in the question but I did ask for that in my original queston.
0
 
LVL 3

Expert Comment

by:PinTail
ID: 1402759
FindXXX are not remote processes, they are running on your local machine, it's just that they are looking at a remote machines directory structure.  Since this is the case, the server doesn't 'send' anything, the client 'retrieves' ( although the client is making use of the servers file system, so in reality the server is 'sending', but programatically - with FindXXX - it is not ).


How you display the data enumerated from FindXXX is your business

send() and recv() ??? are you trying to use sockets for this.


0
 
LVL 7

Expert Comment

by:leflon
ID: 1402760
don' t send all the information from your server to your clients. just tell the clients which shared directory (or a subdirectory of a shared one) to scan.
so the client gets UNC path and here just follow what wylliker proposed.
if your question is about client/server communication, thats another story.
0
 

Author Comment

by:redhat092798
ID: 1402761
My question is about client/server situation over internet. Not on a LAN or a WAN.
Sorry for not being more clear.
0
 
LVL 4

Expert Comment

by:wylliker
ID: 1402762
If you are talking about using the internet, if you are specifically using this for FTP then you can use

FtpFindFirstFile - see the docs on this call it is different from FindFirstFile - it also fills in a WIN32_FIND_DATA structure.

Follow this call in your loop for InternetFindNextFile.

You will need to establish an internet connection using the WinInet API first.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

722 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