Find # of Items in folders
Posted: 10 Sep 2015 11:02
How to list folders which contains only, say, 5, items?
Thanks in advance.
Thanks in advance.
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Code: Select all
$limitFiles = 5;
$result = "";
foreach($folder, quicksearch("* /d", "<curpath>", "|")) {
$files = quicksearch("* /f", $folder);
if (gettoken($files, "count", "<crlf>") == $limitFiles) {
$result = $result . $folder . "<crlf>";
}
}
if ($result) {
text "Folder(s) with more than " . $limitFiles . " file(s):<crlf 2>". $result;
} else {
status "No appropriate folders found...", "8B4513", "stop";
}Code: Select all
$limitFiles = 5;
setting "AllowRecursion", 1;
$folders = quicksearch("* /d", "<curpath>", "|");
$result = "";
foreach($folder, $folders) {
$files = quicksearch("* /f", $folder);
if (gettoken($files, "count", "<crlf>") == $limitFiles) {
$result = $result . $folder . "<crlf>";
}
}
if ($result) {
text "Folder(s) with more than " . $limitFiles . " file(s):<crlf 2>". $result;
} else {
status "No appropriate folders found...", "8B4513", "stop";
}