Date: Thu, 5 Nov 1998 18:58:16 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Marc Brooker cc: djgpp AT delorie DOT com Subject: Re: Files In A Directory In-Reply-To: <354f26ae.3464260@ct-news.iafrica.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Thu, 5 Nov 1998, Marc Brooker wrote: > I need to write a simple program to count the files in a directory, I > am currently using a program that is passed > count *.* > and it outputs the number of arguements, is there a better way to do > this? I think this is the best way, unless this is a class assignment and they actually want you to write some code that accesses the directory. Note that in DJGPP, *.* only expands to files that actually have an extension. If you want all files, use just * without the dot and the second asterisk. Another gotcha is that this will not count files with hidden/system attributes, since the startup code that expands the wildcards skips them. (There are ways to force it to not skip them, in case you need that.)