Monday, January 16, 2012

PHP Recursive File Handling Tutorial Delete All Files in Directory Folder

Script: www.developphp.com In this tutorial Adam demonstrates how to use the opendir() and glob() functions to access and delete folder contents recursively within our website file system. The word recursive or recursion means to repeat an operation over and over again. Both methods are slim enough and they're easy to understand. We touched on this kind of programming within the Magic XML PHP series of videos but we never explained recursive deletion of the files we access. Which is a pretty popular usage for this kind of script. Deleting files recursively. Especially if you have to use the rmdir() function for deleting a folder in your file system. The rmdir() function requires that a folder be empty before it can be deleted itself.

No comments:

Post a Comment