Jump to content

delete contents of file on server


kev wood

Recommended Posts

i have found this code but would like someone who has used this before to tell me if it will do what i want it to.  i do not want to go deleting everything on the server just the contents of one file.

 

the code i have found is as follows.

 

<? 
$mydir = "/path/to/dir/"; 
$d = dir($mydir); 
while($entry = $d->read()) { 
if ($entry!= "." && $entry!= "..") { 
unlink($entry); 
} 
} 
$d->close(); 
rmdir($mydir); 
?>

Link to comment
https://forums.phpfreaks.com/topic/106470-delete-contents-of-file-on-server/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.