The -e isif file exist and the -d is if the directory exist. I would have to agree with your third snip of code.
if (-d $path){&get_on_with_it} else {&errorMsg} >From: Bob Showalter <[EMAIL PROTECTED]> >To: "'K.L. Hayes'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >Subject: RE: Should I use -e -d or opendir ? >Date: Thu, 10 Jan 2002 08:49:17 -0500 > > > -----Original Message----- > > From: K.L. Hayes [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 10, 2002 12:28 AM > > To: [EMAIL PROTECTED] > > Subject: Should I use -e -d or opendir ? > > > > > > Hello All, > > > > I've found lot's of info on how to check if a file exists but nothing > > about checking if a directory exists. I've posted the relevant code > > below along with 3 variations of how I "think" it might work. If > > somebody could point to the one that is "correct" or knows of a better > > way I'd appreciate the help. Thank you. > > > > <CODE_SNIP> > > use constant USER_PATH => '/home/~client/htdocs/clients/'; > > $path = USER_PATH . $personal_key; > > > > ## Is This Correct? ## > > if (-e "$path") { > > &get_on_with_it } > > else { &errorMsg } > > > > ## Or This? ## > > opendir(CLIENT, "$path") or die " &errorMsg "; > > closedir(CLIENT); > > &get_on_with_it > > > > ## Or Is It This? ## > > if (-d $path) { > > &get_on_with_it } > > else { &errorMsg } > > <!CODE_SNIP> > >Probably you just want -d. > >-e returns true for plain files, symlinks, sockets, etc. as well as >for directories, so that's not what you want. > >opendir() will fail if you don't have read permission on the directory. > > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]