return $filesize;
}
-function get_directory_list($rootdir, $excludefile="", $descend=true) {
+function get_directory_list($rootdir, $excludefile="", $descend=true, $justdirs=false) {
/// Returns an array with all the filenames in
/// all subdirectories, relative to the given rootdir.
/// If excludefile is defined, then that file/directory is ignored
+/// If justdirs is defined, then only subdirectories are listed, otherwise just files
$dirs = array();
if ($firstchar == "." or $file == "CVS" or $file == $excludefile) {
continue;
}
- $fullfile = $rootdir."/".$file;
+ $fullfile = "$rootdir/$file";
if ($descend and filetype($fullfile) == "dir") {
- $subdirs = get_directory_list($fullfile, $excludefile, $descend);
+ if ($justdirs) {
+ $dirs[] = $file;
+ }
+ $subdirs = get_directory_list($fullfile, $excludefile, $descend, $justdirs);
foreach ($subdirs as $subdir) {
- $dirs[] = $file."/".$subdir;
+ $dirs[] = "$file/$subdir";
}
- } else {
+ } else if (!$justdirs) {
$dirs[] = $file;
}
}