Post: Need a code that deletes pictures in a directory!
08-06-2011, 03:48 PM #1
Nero.
Space Ninja
(adsbygoogle = window.adsbygoogle || []).push({}); So in my screensnapr site I have an admin section
in this section I would like a delete all screensnapr pictures
also I have a page in my site that you can upload your own pictures, I have a code that deletes all them
maybe you can edit the code so you can delete the screensnapr pictures?
heres the delete other peoples uploaded pictures

    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Awesome faceelete all images</title>
</head>

<body>

<?
$dir = 'image_files/';
// open specified directory
$dirHandle = opendir($dir);
$total_deleted_images = 0;
while ($file = readdir($dirHandle)) {
// if not a subdirectory and if filename contains the string '.jpg'
if(!is_dir($file)) {
// update count and string of files to be returned
unlink($dir.$file);
echo 'Awesome faceeleted file <b>'.$file.'</b><br />';
$total_deleted_images++;
}
}
closedir($dirHandle);
if($total_deleted_images=='0'Winky Winky{
echo 'There ware no files uploaded there.';
}
echo '<br />Thank you.';
?>

</body>
</html>



But I put that code in the admin cp and it stopped working??
Please help Happy
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo