xavikevicious
December 20th, 2004, 04:40 AM
i have one file and one directory in a folder. i created them with mkdir function and they have 777 permissions. i want to remove both, but i can't to do it because my server no recognize them as a file and a dir.
My code:
$dir=chdir("scripts");
$handle=opendir('./Analisi_Programa_Anticopia/Fitxer');
while ($file = readdir($handle)){
echo "$file\n";
if($fit = is_file($file)){
echo "File? ".$fit."\n";
if(!unlink($file)){
echo "File not remove";
}
else echo "File remove";
}
else if($direc = is_dir($file)){
echo "Directory? ".$direc."\n";
if(!rmdir($file)){
echo "Directory not remove";
}
else echo "Directory remove";
}
else echo "Not file or directory";
$a = filetype($file);
echo "My type file is: ".$a."\n";
}
closedir($handle);
When my file is file type, this not entry in first if and when this is directory, this not entry to the second if. Both write to screen:Not file or directory. On filetype function both files are type files empty. What happens??
My code:
$dir=chdir("scripts");
$handle=opendir('./Analisi_Programa_Anticopia/Fitxer');
while ($file = readdir($handle)){
echo "$file\n";
if($fit = is_file($file)){
echo "File? ".$fit."\n";
if(!unlink($file)){
echo "File not remove";
}
else echo "File remove";
}
else if($direc = is_dir($file)){
echo "Directory? ".$direc."\n";
if(!rmdir($file)){
echo "Directory not remove";
}
else echo "Directory remove";
}
else echo "Not file or directory";
$a = filetype($file);
echo "My type file is: ".$a."\n";
}
closedir($handle);
When my file is file type, this not entry in first if and when this is directory, this not entry to the second if. Both write to screen:Not file or directory. On filetype function both files are type files empty. What happens??