Deletes a directory in the server’s file system.

function deleteDirectory($dir, $DeleteMe) {
  if(!$dh = @opendir($dir)) return;
  while (false !== ($obj = readdir($dh))) {
    if($obj=='.' || $obj=='..') continue;
    if (!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, true);
  }
  closedir($dh);
  if ($DeleteMe){
  @rmdir($dir);
}

Delete a file in the file system. Note that this file system we’re talking about is the server’s file system. PHP nor other web-based programming language deletes a file system on the client’s side.

function deleteFile($filename) {
  $do = unlink($filename);

  if ($do=="1") {
    echo "The file was deleted successfully.";
  } else {
    echo "There was an error trying to delete the file.";
  }
}

Related Posts Plugin for WordPress, Blogger...