Page 1 of 2

how get selected folder files count?

Posted: 20 Nov 2015 09:57
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

Re: how get selected folder files count?

Posted: 20 Nov 2015 10:04
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:

Re: how get selected folder files count?

Posted: 20 Nov 2015 10:24
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...?

Re: how get selected folder files count?

Posted: 20 Nov 2015 10:35
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"));
    }

Re: how get selected folder files count?

Posted: 20 Nov 2015 11:13
by drjs5x
great but 321_foldername 41_folderabc 85_foldermyyy count_foldername or foldername_count?

Re: how get selected folder files count?

Posted: 20 Nov 2015 11:21
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...

Re: how get selected folder files count?

Posted: 20 Nov 2015 11:30
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....

Re: how get selected folder files count?

Posted: 20 Nov 2015 11:33
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?

Re: how get selected folder files count?

Posted: 20 Nov 2015 11:50
by highend
Same as before but foldersize() without using a template and formatting the raw bytes with formatbytes()?

Re: how get selected folder files count?

Posted: 20 Nov 2015 12:06
by drjs5x
an example please because i tryed that $fileCount = foldersize($file, "<b>"); and proplem result 1.2 gb result 2gb :(

i cant ...

Re: how get selected folder files count?

Posted: 20 Nov 2015 12:12
by highend
Then show your code?

Re: how get selected folder files count?

Posted: 20 Nov 2015 12:26
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..

Re: how get selected folder files count?

Posted: 20 Nov 2015 12:36
by highend

Code: Select all

    $number = gettoken($fileCount2, 1, " ");
    $desc   = gettoken($fileCount2, 2, " ");
    $newName = $desc . $number . "_" . getpathcomponent($file, "file");

Re: how get selected folder files count?

Posted: 20 Nov 2015 12:38
by drjs5x
full script please im newbie dear master. ???


:ugeek: :ugeek: :ugeek: :ugeek: :ugeek: :wink: :wink: :wink: :oops: :oops: :oops: :oops:

Re: how get selected folder files count?

Posted: 20 Nov 2015 12:44
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?