deleting DIR:  ' , $tree_root_dir ; // ========================================================================= // SUCCESS! // ========================================================================= return TRUE ; // ========================================================================= // That's that! // ========================================================================= } // ============================================================================= // empty_directory_tree() // ============================================================================= function empty_directory_tree( $tree_root_dir , $question_check_root = FALSE ) { // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x210_directoryOperations\ // empty_directory_tree( // $tree_root_dir , // $question_check_root = FALSE // ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Empties the specified directory tree. // // In other words, all the descendant directory, files and links beneath // $tree_root_dir // // (if any), are deleted. But:- // $tree_root_dir // // itself is NOT deleted. // // $question_check_root indicates whether we should check if the specified // root directory exists (before doing anything). // // RETURNS // o On SUCCESS! // - - - - - - // TRUE // // o On FAILURE! // - - - - - - // $error_message STRING // ------------------------------------------------------------------------- // ========================================================================= // Root dir exists ? // ========================================================================= if ( $question_check_root && ! is_dir( $tree_root_dir ) ) { $ln = __LINE__ ; return <<' , $tree_root_dir , '' ; // ========================================================================= // Open the root directory... // ========================================================================= // ------------------------------------------------------------------------- // resource opendir ( string $path [, resource $context ] ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Opens up a directory handle to be used in subsequent closedir(), // readdir(), and rewinddir() calls. // // path // The directory path that is to be opened // // context // For a description of the context parameter, refer to the streams // section of the manual. // // Returns a directory handle resource on success, or FALSE on failure. // // If path is not a valid directory or the directory can not be opened due // to permission restrictions or filesystem errors, opendir() returns FALSE // and generates a PHP error of level E_WARNING. You can suppress the error // output of opendir() by prepending '@' to the front of the function name. // // (PHP 4, PHP 5) // ------------------------------------------------------------------------- // ob_start() ; $dir_handle = @opendir( $tree_root_dir ) ; // $php_err_msg = trim( ob_get_clean() ) ; // ------------------------------------------------------------------------- if ( $dir_handle === FALSE ) { $ln = __LINE__ ; return <<' , $basename , '' ; // ===================================================================== // All entries done ? // ===================================================================== if ( $basename === FALSE ) { break ; } // ===================================================================== // Skip "." and ".."... // ===================================================================== if ( $basename === '.' || $basename === '..' ) { continue ; } // ===================================================================== // Convert the basename to pathspec... // ===================================================================== $pathspec = $tree_root_dir . '/' . $basename ; //echo '
' , $pathspec , '' ; // ===================================================================== // Process the dir/file/link... // ===================================================================== if ( is_dir( $pathspec ) ) { // ================================================================= // DIR // ================================================================= // ------------------------------------------------------------------------- // \greatKiwi_pluginMaker_pluginVersion_directoryOperations\delete_directory_tree_base( // $tree_root_dir , // $question_check_root // ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Deletes the specified directory tree. // // In other words, deletes the specified directory and all of it's // descendants. // // RETURNS // o On SUCCESS! // - - - - - - // TRUE // // o On FAILURE! // - - - - - - // $error_message STRING // ------------------------------------------------------------------------- $result = delete_directory_tree_base( $pathspec , $question_check_root_FALSE ) ; // ----------------------------------------------------------------- if ( is_string( $result ) ) { closedir( $dir_handle ) ; return $result ; } // ----------------------------------------------------------------- } elseif ( is_file( $pathspec ) ) { // ================================================================= // FILE // ================================================================= // ------------------------------------------------------------------------- // bool unlink ( string $filename [, resource $context ] ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Deletes filename. Similar to the Unix C unlink() function. A E_WARNING // level error will be generated on failure. // // filename // Path to the file. // // context // Note: Context support was added with PHP 5.0.0. For a // description of contexts, refer to Streams. // // Returns TRUE on success or FALSE on failure. // // (PHP 4, PHP 5) // ------------------------------------------------------------------------- $result = unlink( $pathspec ) ; // echo '
deleting FILE:  ' , basename( $pathspec ) ; // $result = TRUE ; // ----------------------------------------------------------------- if ( $result !== TRUE ) { closedir( $dir_handle ) ; $ln = __LINE__ ; return <<deleting SYMBOLIC LINK:  ' , basename( $pathspec ) ; // $result = TRUE ; // ----------------------------------------------------------------- if ( $result !== TRUE ) { closedir( $dir_handle ) ; $ln = __LINE__ ; return <<