// Open the directory for reading
$res = opendir("/temp/junkfolder");
// Go thru each file in the directory and store the name in the variable $f
while(($f = readdir($res)) != false) {
// Avoid the special "." and ".." files
if(strcmp($f, ".") != 0 && strcmp($f, "..") != 0) {
if ($f=="yourfile" ) { // your certain file
// Remove the file
unlink("/temp/junkfolder/$f");
}
}
}
// The directory is now empty, so remove it.
unlink("/temp/junkfolder"); // since we only delete a certain file we cannot delete the folder