How can i delete unused and unneeded images from a folder using php ?
Hi all
i need to know if there is by a way by any chance to delete unused images from my virtual directory or wwwroot folder dunamically on the user request using php ?
thank you all
Yes this should be possible. There may be some scripts already written to do this although I am not aware of them. You could try searches on google and yahoo to see what you can find. If you don't find anything useful, you will find most of the php functions you will need here .
thank you for such a wonderful reference you gave me
i checked it out and found the way to delete files and folders
and it was just so simple lol
for your reference the code is as this :
<?php
unlink("filename");
?>
can it be more simple ?
lol
it would be better to check 1st if the file is in the directory ^^
i got this from the php manual :)
hope it helps you as well
<?php
if(file_exists($file))
unlink($file);
?>