Example of deleting a group of files in php
-
2. delete the code process. php for a group of files
- # Take each checked value, and give it a name of $ delete
- Foreach ($ _ POST ['delete'] as $ delete ){
- # Make sure the file actually exists
- If (file_exists ("/location/of/directory/". $ delete )){
- # Delete each file
- Unlink ("/location/of/directory/", $ delete );
- } Else {
- Continue;
- }
- }
- # Return to form.html
- Header ("Location: form.html ");
- ?>
Articles you may be interested in: Php: Delete a specified file and folder. PHP deletes a small example php instance of all files created N minutes ago: batch delete folders and files in folders delete all files in a specified folder php code delete multi-level directory php user-defined function php recursively delete files and directory code php recursively delete directories and multi-level subdirectories code for All files php code for recursive creation and deletion of folders php example of Recursive directory deletion |