www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/20/07:24:17

From: James Vasile <Vasile AT IName DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: getting all filename in sub-directory
Date: Wed, 20 Oct 1999 03:14:14 -0400
Organization: Columbia University
Lines: 42
Message-ID: <2WkNOD+aOiKHSPaxaS9gBddALHrJ@4ax.com>
References: <7nliit$uvc$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: dialup-cc3-23.cc.columbia.edu
Mime-Version: 1.0
X-Trace: newsmaster.cc.columbia.edu 940403599 10637 128.59.42.128 (20 Oct 1999 07:13:19 GMT)
X-Complaints-To: postmaster AT columbia DOT edu
NNTP-Posting-Date: 20 Oct 1999 07:13:19 GMT
X-Newsreader: Forte Agent 1.6/32.525
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

//code off the top of my head, might be buggy
void do_all_bats() {
        struct ffblk file_block;
        int done;

         done = findfirst("*.bat", &file_block,  FA_DIREC);
         while (!done) {
            do_one_dir (file_block.ff_name);
            done = findnext(& file_block);
         }
}

In do_one_dir, change dir to file_block.ff_name and use code similar
to the above.

I might direct your attention to
http://www.delorie.com/djgpp/doc/libc-2.02/libc_289.html for more info
on findfirst.

I hope that helps.

Peace,
-James

On Wed, 28 Jul 1999 00:24:02 GMT, chongkong AT my-deja DOT com wrote:

>is there any sample code to do a recursive process for file of a
>certain extension from a parent directory and its sub-directory?
>
>i thinking of using system("dir > tmpfilename")
>and then checking tmpfilename.
>
>or is there a much better way
>
>but i really have no clue on how to go on and search all the sub-
>directory
>
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019