I am working on a PHP script where I want to delete some files from a given folder using a wildcard (*).
I found some working examples, for example this one where functions unlink()and are used glob().
Now I was wondering, would it also be ok to delete files using a function execand command like rm -f /path/to/folder/_prefix_*?
Are there any security risks associated with this?
And if everything is in order, would it be better in terms of performance?
EDIT:
So, from the first answers, I see that using execmight be an acceptable solution.
What about performance issues? Is there a chance that the option execmay be better (faster / less demanding) by the method glob/unlink?
Thank you in advance
source
share