Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to use PHP for the removal of all files within a folder. Here is an example code snippet:

$folder_path = "path/to/folder";

// Get all the files within the folder
$files = glob($folder_path . '/*');

// Loop through each file and remove it
foreach ($files as $file) {
    if (is_file($file)) {
        unlink($file);
    }
}

This code will remove all files within the specified folder by using the glob function to retrieve a list of all files within the folder and then looping through each file and deleting it using the unlink function.