Number of files in a folder

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
zakoul
Posts: 130
Joined: 11 Dec 2019 10:44

Re: Number of files in a folder

Post by zakoul »

How do I apply a red label ?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Number of files in a folder

Post by highend »

tag / tagitems()

Maybe reading the help file would... help?
One of my scripts helped you out? Please donate via Paypal

zakoul
Posts: 130
Joined: 11 Dec 2019 10:44

Re: Number of files in a folder

Post by zakoul »

Code: Select all

    $hardlinks = property("#hardlinks", <cc_item>);
    if ($hardlinks > 1) { return $hardlinks; }
    $files = listfolder(<cc_item>, , 1, <crlf>);
    $cntFiles = 0;
    foreach($file, $files, <crlf>, "e") {
        if (property("#HardLinks", $file) > 1) { $cntFiles++; }
    }
	$allFiles = gettoken($files, "count", <crlf>);
	if ( $cntFiles > 0 && $cntFiles == $allFiles) { tag 1, <cc_item> } 
	else { tag 0, <cc_item> }
    return ($cntFiles ? $cntFiles . "/" . $allFiles  : "");
it was difficult for me

Post Reply