--- filetree.module	2011-02-21 16:01:29.000000000 +0100
+++ filetree.module	2011-05-10 13:29:00.000000000 +0100
@@ -73,6 +73,7 @@
     'controls' => TRUE,
     'extensions' => TRUE,
     'absolute' => TRUE,
+    'exclude' => NULL,
   );
 
   // The token might be present multiple times; loop through each instance.
@@ -108,6 +109,8 @@
       ) {
       continue;
     }
+    if (!array_key_exists('exclude', $params[$key])) $params[$key]['exclude'] = $default_params['exclude'];
+    $params[$key]['exclude'] = str_replace(';', "\n", $params[$key]['exclude']);
 
     // Render tree.
     $files = _filetree_list_files($params[$key]['uri'], $params[$key]);
@@ -131,7 +134,7 @@
   if (is_dir($dir) && $handle = opendir($dir)) {
     $folders = $files = array();
     while (FALSE !== ($file = readdir($handle))) {
-      if (!in_array($file, array('.', '..', 'CVS')) && $file[0] != '.') {
+      if (!drupal_match_path($file, $params['exclude']) &&!in_array($file, array('.', '..', 'CVS')) && $file[0] != '.') {
         if (is_dir("$dir/$file")) {
           $folders[$file] = array(
             'data' => $file,
