Try to add the following line above all code: clearstatcache();
This clears the status from previous is_dir()'s. Good luck, Joakim > -----Original Message----- > From: Dean Dunn [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 22, 2002 6:11 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Help is_dir command driving me crazy! > > > Can anyone tell me why this script doesn't work properly. > I've coded it > several others ways including using is_dir pointing to the full path. > Nothing works reliably, it works sometimes/sometimes not. > > One interesting thing is that my PHP ecommerce app > (osCommrce) is run and > then my script is run it always seems to work. This to me > points to some > form of initialisation I'm missing. > > Any advice would be gratefully received. > > Regards, > > Dean (a new PHP user) > > Code Follows........ > > <?php > > $dir_path = "\Inetpub\wwwroot\catalog\images"; > $dir = "abc"; > $complete_path = "$dir_path\\$dir"; > $dir_exists = "Directory already exists...can not create again<BR>"; > $dir_not_exist = "Directory does not exist...will try and create new > directory<BR>"; > $dir_create_success = "Directory created<BR>"; > $dir_create_failure = "Could not create directory<BR>"; > > print ("Checking to see if subdirectory \"<B>$dir_path\\$dir </B>\" > exists<BR><BR>"); > > if (is_dir($complete_path) == true) > { > print $dir_exists; > } > > else > { > print $dir_not_exist; > chdir ($dir_path); > if (mkdir ("abc",0700) == true) { > print $dir_create_success; } > else { print $dir_create_failure; } > } > ?> > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]