how get selected folder files count?

Discuss and share scripts and script files...
drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

how get selected folder files count?

Post by drjs5x »

hi dears.

how get selected folder files count?

example i focus c:\my pictures
how can count selected folder files count with subdirs files...?
ok
newbie or not...........

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how get selected folder files count?

Post by highend »

Code: Select all

text gettoken(quicksearch("* /f", "<get SelectedItemsPathNames ;>"), "count", "<crlf>");

Code: Select all

    $fileCount = 0;
    foreach($folder, "<get SelectedItemsPathNames |>") {
        $fileCount = $fileCount + foldersize($folder, "<f>");
    }
And please stop using multiple quotation marks. As single one already marks a question :mrgreen:
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

good ;)

i can use different script and successful.

echo foldersize(<focitem>, "<f>");

how i can multiple selected folders rename this method ?

exAMPLE İ SELECTED 5 FOLDERS .
how can batch rename these folders with files count per folder...?
newbie or not...........

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how get selected folder files count?

Post by highend »

Code: Select all

    setting "BackgroundFileOps", 0;
    foreach($folder, "<get SelectedItemsPathNames |>") {
        if (exists($folder) != 2) { continue; }
        $fileCount = foldersize($folder, "<f>");
        renameitem($fileCount, regexreplace($folder, "^(.*\\)(.*)", "$2"));
    }
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

great but 321_foldername 41_folderabc 85_foldermyyy count_foldername or foldername_count?
newbie or not...........

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how get selected folder files count?

Post by highend »

Code: Select all

    setting "BackgroundFileOps", 0;
    foreach($folder, "<get SelectedItemsPathNames |>") {
        if (exists($folder) != 2) { continue; }
        $fileCount = foldersize($folder, "<f>");
        $folderName = regexreplace($folder, "^(.*\\)(.*)", "$2");
        renameitem("$fileCount_$folderName", $folderName);
        // renameitem("$folderName_$fileCount", $folderName);
    }
And again, please stop using multiple punctuation marks...
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

i can ... :)))



""
setting "BackgroundFileOps", 0;
$curBase = gettoken("<curpath>", -1, "\");
foreach($file, "<get SelectedItemsPathNames |>") {

$fileCount = foldersize($file, "<f>");
msg $fileCount;

$newName = $fileCount."_".$curBase . "-" . getpathcomponent($file, "file");



renameitem($newName, $file , "-01");
}





""

filecount_updirname_foldername..... batch.......... superr....
newbie or not...........

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

you are wonderful dear reallyyyy thanks for you.


now i try folder size? possible

mb24_foldernameA mb45_foldername
or flexiblee kb245_testfolder1 mb45_testfoldergdfhgfh gb2.5_foldernamerewrtet

this is possible?

or your idea?
newbie or not...........

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how get selected folder files count?

Post by highend »

Same as before but foldersize() without using a template and formatting the raw bytes with formatbytes()?
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

an example please because i tryed that $fileCount = foldersize($file, "<b>"); and proplem result 1.2 gb result 2gb :(

i cant ...
newbie or not...........

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how get selected folder files count?

Post by highend »

Then show your code?
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

i cannnnnnnnnnnnnnnn... :whistle: :whistle: :whistle: :oops: :oops: :oops: :oops: :oops:
but half.... not perfect ..


""
setting "BackgroundFileOps", 0;
$curBase = gettoken("<curpath>", -1, "\");
foreach($file, "<get SelectedItemsPathNames |>") {

$fileCount = foldersize($file, <r>);$fileCount2=formatbytes("$fileCount", "FLEX");
// msg $fileCount2;

$newName = $fileCount2."-" . getpathcomponent($file, "file");



renameitem($newName, $file , "-01");
}

""




result 105.25 KB_folderA ... 1.39 MB_FolderB ... 1.35 GB_Foldernamecvdfg ... etc

good but half my wish...


KB105.25_FolderA MB1.39_FolderB.... GB1.35_Foldernameesdfh etc..

i cant make replace :((( can u? convert theese format?


or KB_105.25_FolderA MB_1.39_FolderB.... GB_1.35_Foldernameesdfh etc..
newbie or not...........

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how get selected folder files count?

Post by highend »

Code: Select all

    $number = gettoken($fileCount2, 1, " ");
    $desc   = gettoken($fileCount2, 2, " ");
    $newName = $desc . $number . "_" . getpathcomponent($file, "file");
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

full script please im newbie dear master. ???


:ugeek: :ugeek: :ugeek: :ugeek: :ugeek: :wink: :wink: :wink: :oops: :oops: :oops: :oops:
newbie or not...........

drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

Re: how get selected folder files count?

Post by drjs5x »

and 2nd wish...

how can multi line script tag example

"copy image types to clipboard|jpg.ico" copytext "*.jpg;*.png;*.gif;*.bmp;*.jpeg;*.gif";

that working custom button title without proplem

but multi line script i cant work any script

""
"custom button title for title|mycustom01.ico" setting "BackgroundFileOps", 0;
foreach($file, "<get SelectedItemsPathNames |>") {

$fileCount = foldersize($file, <r>);$fileCount2=formatbytes("$fileCount", "FLEX");
// msg $fileCount2;

$newName = $fileCount2."-" . getpathcomponent($file, "file");



renameitem($newName, $file , "-01");
}

""


how can multi line scripts title without proplem?
newbie or not...........

Post Reply