Hi, I wrote a script in order to check if a certain directory exist, and it doesn't exist, it should open one. $day = date("d"); $month = date("m"); $year = date("Y"); if (!is_dir(files/$year)) { mkdir("files/$year",0777); } if (!is_dir(files/$year/$month)) { mkdir("files/$year/$month",0777); } if (!is_dir(files/$year/$month/$day)) { mkdir("files/$year/$month/$day",0777); } Now, the directories already exist, but every time I try to run the script I get this error: Warning: mkdir() [function.mkdir]: File exists in /home/.tristessa/maverick/dbzfan.com/NEW/script.php on line 10 Warning: mkdir() [function.mkdir]: File exists in /home/.tristessa/maverick/dbzfan.com/NEW/script.php on line 13 Warning: mkdir() [function.mkdir]: File exists in /home/.tristessa/maverick/dbzfan.com/NEW/script.php on line 16 Why does it try to create them while they already exist? Thanks in advance.
hi, I think you just forgot some quotes... try it like this: $day = date("d"); $month = date("m"); $year = date("Y"); if (!is_dir("files/$year")) { mkdir("files/$year",0777); } if (!is_dir("files/$year/$month")) { mkdir("files/$year/$month",0777); } if (!is_dir("files/$year/$month/$day")) { mkdir("files/$year/$month/$day",0777); } PHP: Did not test it, but it should work now