";
} else {
echo "Error deleting file '$file'.
";
}
}
}
}
// Close the directory handle
closedir($handle);
// Attempt to remove the directory itself
if (rmdir($dir)) {
echo "Directory '$dir' deleted successfully.
";
} else {
echo "Error deleting directory '$dir'.
";
}
}
}
$folderPath = '/home/u146541135/domains/zemail.me/public_html/public/tmp/attachments/';
// Ensure the folder path exists and is a directory
if (is_dir($folderPath)) {
deleteFiles($folderPath);
} else {
echo "Folder '$folderPath' does not exist or is not a directory.";
}