Project

General

Profile

Bug #5964 » bp-group-documents-remove-empty-folders.php

Daniel Jones, 2017-11-07 11:42 AM

 
1
<?php
2
function remove_empty_subfolders($path) {
3
	$path = rtrim($path, '/');
4
	foreach(glob($path . "/*") as $subdir) {
5
		if (is_dir($subdir)) {
6
			if (!count(glob($subdir . "/*")))
7
				rmdir($subdir);
8
		}
9
	}
10
}
11

    
12
remove_empty_subfolders($args[0]);
13
?>
    (1-1/1)