Answer the question
In order to leave comments, you need to log in
Script to remove images from hosting in php?
Help need a script that will remove images from the hosting from a specific folder.
Let's say pictures in /domains/exemple.ru/public_html/mega1/f/images
I tried this script but it doesn't work
if (file_exists('./maps1/files'))
foreach (glob('./maps1/files/*.png') as $file)
unlink($file);
Answer the question
In order to leave comments, you need to log in
you should have a script like this (other ways):
if (file_exists('./images/'))
foreach (glob('./images/*.png') as $file)
unlink($file);
file_exists() checks for the existence of a FILE, not a folder, is_dir() is needed here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question