Quote:
Originally Posted by cerulean
If I were you, I would avoid doing this in PHP (and I'm primarily a PHP developer.) PHP is certainly capable of this, but loading a programming language runtime just to run existing system commands does complicate the process.
If you're on Linux, you can use the find command and your host should be well-versed in how to do this anyway:
https://stackoverflow.com/a/69374901
If you're on Windows, similar things exist:
https://stackoverflow.com/a/51069
Either way, you should make backups of these files before deleting them, and you should capture the output of whatever you run, and send a notification on success. That way you know when it runs, and whether it's successful.
|
For the record, the overhead of executing PHP to run file commands like unlink while is overhead, it's negligible and you shouldn't complicate things for yourself because someone else's preferences.