From 35ea159433eb57c78d9346bee8aa44510491a04b Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 3 Aug 2003 00:40:08 +0000 Subject: [PATCH] delete_dir_contents function now allows excluding a dir --- backup/lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backup/lib.php b/backup/lib.php index 9bc0c6c015..8276bbf7fc 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -92,8 +92,9 @@ } //Function to delete all the directory contents recursively + //it supports a excluded dit too //Copied from the web !! - function delete_dir_contents ($dir) { + function delete_dir_contents ($dir,$excludeddir="") { $slash = "/"; @@ -111,10 +112,10 @@ // Loop through all directory entries, and construct two temporary arrays containing files and sub directories while($entry = readdir($handle)) { - if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != ".") { + if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) { $dir_subdirs[] = $dir. $slash .$entry; } - else if ($entry != ".." && $entry != ".") { + else if ($entry != ".." && $entry != "." && $entry != $excludeddir) { $dir_files[] = $dir. $slash .$entry; } } -- 2.39.5