Date: Thu, 13 Apr 2000 17:31:54 +0200 (MET DST) From: pad2369 Message-Id: <200004131531.RAA00387@maggiore.iperbole.bologna.it> To: djgpp AT delorie DOT com, Gabriel Ortiz Lour References: <38F5CA5F DOT BF66424B AT softone DOT com DOT br> In-Reply-To: <38F5CA5F.BF66424B@softone.com.br> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP3 Imap webMail Program 2.0.11 Sender: pad2369 AT iperbole DOT bologna DOT it Subject: Re: directory structure. Reply-To: djgpp AT delorie DOT com Gabriel Ortiz Lour : > What is a good method for searching for files in a given > directory and for the directories in the root? You can use findfirst/findnext functions, like this: ----- 8< ----- /* warning: untested code */ struct ffblk F; int flag; /* search for all .txt files in directory c:\mydir */ flag = findfirst("c:\\mydir\\*.txt", &F, 0); while (!flag) { // information for the file are in structure F // do whatever you need... printf("%s\n", F.ff_name); flag = findnext(&F); } ----- 8< ----- Iff you need to find all directories in the root you replace the call to findfirt like this: flag = findfirst("c:\\*.*", &F, FA_DIREC); More info can be found in the C library documentation (type "info libc alpha findfirst" at command prompt) You can also look at function ftw(), which allows you to traverse all sub-directories of a give directory, like some sort of "recursive findfirst/next" > When I found my self in trouble, someone came to me with words of > wisdom... > write in C! Write in C, yeah, Write in C. BASIC's not the answer. Write in C. ciao Giacomo ------------------------------------------------------ Giacomo Degli Esposti - pad2369 AT iperbole DOT bologna DOT it