Cheat sheet for opendir()

Richard Kreiss rkreiss at verizon.net
Tue Dec 1 09:01:15 PST 2009



> -----Original Message-----
> From: filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com
[mailto:filepro-
> list-bounces+rkreiss=verizon.net at lists.celestial.com] On Behalf Of John
Esak
> Sent: Tuesday, December 01, 2009 10:28 AM
> To: filepro-list at lists.celestial.com
> Subject: RE: Cheat sheet for opendir()
> 
> Ahh, good picking... It just shows how you can fool yourself with bad
> testing.  Before I posted that, I tested on both Unix and Windows. On Unix
I
> used a directory called /tmp/test which I made for the purpose of the
test.
> Then, Windows I made a directory called c:\test and ran the same
opendir(),
> it of course returned "." and "..".  Never thought about opening a root
> folder.  Thanks.
> 
> John
> 
> > -----Original Message-----
> > From: Kenneth Brody [mailto:kenbrody at spamcop.net]
> > Sent: Tuesday, December 01, 2009 10:19 AM
> > To: john at valar.com
> > Cc: filepro-list at lists.celestial.com
> > Subject: Re: Cheat sheet for opendir()
> >
> > John Esak wrote:
> > [...]
> > > Here comes some of the hinty things.  If you ask for
> > *every* file in a
> > > directory, opendir() will always find at least two (2)
> > files.  You will not
> > > usually find n to be equal to zero even in an empty
> > directory.  That is
> > > because there are always two files in any folder
> > represented by "." and
> > > "..".
> > [...]
> >
> > Thanks for the informative post.  However, I have one nit to
> > pick.  On
> > Windows filesystems, there are no "." and ".." entries in the
> > root directory.
> >
> > --
> > Kenneth Brody

As far as I am concerned, it is a bad practice to place a file or files one
wants to use in the root directory.  At no time do I want my users(clients)
to have access to a root directory, even through a program.  This can lead
to a disaster either unintentional or intentional.

Richard




More information about the Filepro-list mailing list