[lux commit] r129 - trunk/Lux

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 18, 2008, 3:25:20 PM3/18/08
to lux...@googlegroups.com
Author: rodrigo.moraes
Date: Tue Mar 18 06:00:32 2008
New Revision: 129

Modified:
trunk/Lux/Filesystem.php

Log:
Nifty addition: in rmDir(), a second parameter allows to remove only
files, keeping the directory structure.

Modified: trunk/Lux/Filesystem.php
==============================================================================
--- trunk/Lux/Filesystem.php (original)
+++ trunk/Lux/Filesystem.php Tue Mar 18 06:00:32 2008
@@ -78,12 +78,15 @@

/**
*
- * Deletes a directory recursivelly.
+ * Deletes a directory or directory files recursivelly.
*
* @param string $path Directory path.
*
+ * @param bool $remove_dir If false, keeps the directory
structure, removing
+ * only files.
+ *
*/
- public function rmDir($path)
+ public function rmDir($path, $remove_dir = true)
{
if (is_file($path)) {
// Single file deletion.
@@ -98,11 +101,13 @@
if ($file->isDot()) {
continue;
}
- $this->rmDir($file->getPathname());
+ $this->rmDir($file->getPathname(), $remove_dir);
}

// Delete the directory itself.
- rmdir($path);
+ if ($remove_dir) {
+ rmdir($path);
+ }
}

/**

Reply all
Reply to author
Forward
0 new messages