Page 1 of 1
Sorting directories by size
Posted: 2016-12-24, 21:17 UTC
by xrundel
Default behavior for setting directories sorted by size is unexpected - by default TC just does not perform sorting.
User has to press Alt+Shift+Enter first but I found no info on this operations sequence neither in built-in help system nor in online FAQ.
If user works in Brief view mode he even can't see that Size field values for directories are missing.
Also there is no option to calculate directories size automatically.
DirCalcSize plugin can do it but somehow it proceeds much slower than TC itself.
I suggest to do one of the following:
1.
add Autocalculate directories size as independent variable with three possible states: a. Never. b. Always. c. Only when directories are sorted like files (default state).
2.
add checkbox Autocalculate directories size in Sorting directories area of page Options - Display and make it active only when Like files is selected.
3.
at least add info about pressing Alt+Shift+Enter first in F1, FAQ etc.
For 1 and 2 - if calculation is performed not in background then the method of interruption also should be added.
Now the method of interruption is to press Esc.
Posted: 2016-12-24, 22:12 UTC
by Hacker
Showing directory sizes might finally be practical, now with the Everything integration.
Roman
Posted: 2016-12-25, 00:06 UTC
by ts4242
@
xrundel
There is an internal command
cm_CountDirContent which you can assign any other hotkey
I have the following button that perform sort by size and calc dir size with single click
Code: Select all
TOTALCMD#BAR#DATA
cm_SrcBySize, cm_CountDirContent
wcmicons.dll,36
Dirs Size
-1
Posted: 2016-12-28, 21:34 UTC
by xrundel
ts4242
Thank you for reminding about scripts and custom hotkeys...
But that script will not save time if user browses through subdirectories.
In this case he will need to press the assigned hotkey each time after changing directory - the same way he does now.
The options I suggest are most applicable if there is a lot of (not big) directories to browse.
Also to speed up browsing when directories size automatic calculation is enabled
one more feature once proposed may be of use (I guess it is still in wishlist).
Posted: 2016-12-29, 01:11 UTC
by petermad
2xrundel
You could make a View Mode that executes cm_CountDirContent and then apply it wirh an Auto Switch Mode for folders.
Something like:
[ViewModes]
0_name=<Standard>
0_icon=%COMMANDER_EXE%,6
0_options=-1|-1|0||-1|-1|-1
1_name=Folder
1_icon=%COMMANDER_EXE%,6
2_commands="cm_CountDirContent"
1_options=-1|-1|0||-1|-1|-1
[ViewModeSwitch]
Enabled=1
0_rules=L
0_mode=1
Off course it you have other rules with higher priority than the Folder-rule, you will have to add cm_CountDirConten to all of those for which you want dirsize counting.
Posted: 2016-12-29, 20:33 UTC
by xrundel
petermad
I am afraid I do not understand what is 'make a View Mode' and 'Auto Switch Mode for folders'.
I do not even have any idea where to put the code you wrote and how it works.
What should I read to find it out?
Posted: 2016-12-29, 21:51 UTC
by ts4242
Follow these steps:
1- Show Configuration dialog> View mode page (press Help button for details)
2- Press
Add... then enter desired name e.g. "Auto Calc Folder Size"
3- Column view: ->
Full
4- Sort order: ->
Size
5- Auto-run command: -> enter "
*cm_CountDirContent" (without quotation)
6- Show "Auto Switch Mode" page and select "[x] Automatically switch view mode on directory change:"
7- Press OK
8- In TC file panel, right click any folder tab and select the view mode "Auto Calc Folder Size"
9- Enjoy!

Posted: 2016-12-30, 00:01 UTC
by petermad
Or:
1-6 as described by
ts4242
and then:
7 - Click the Add... button.
8 - Under "Rule:" choose: "L: With drive letter"
9 - At "Set this mode:" choose: "Auto Calc Folder Size" (from point 2)
________
2
ts4242
"[x] Automatically switch view mode on directory change:"
Setting this option without setting any Rule has no effect.
2
xrundel
I do not even have any idea where to put the code you wrote and how it works.
The code was meant for putting in your
wincmd.ini file - you can see the location of that file by clicking "Help" -> "About Total Commander" - or you can use "Configuration" -> "Save Setings Files Directly" (note it opens both settings files)
Posted: 2016-12-30, 00:13 UTC
by xrundel
petermad
Yes, now I understand, you wrote about new configuration page that I did not use yet.
Thank you, I will explore those features.
ts4242
Your instruction basically covers the use case I described and solves the problem.
Excellent workaround, many thanks!
If steps 3-4 are omitted then this view mode will also work when user wants to sort folders by size in brief mode or to see sizes without sorting by it.
petermad
"[x] Automatically switch view mode on directory change:" Setting this option without setting any Rule has no effect
As I see it works fine without setting any rule (at least after TC restart).
all
Thus
if user wants to have directories size calculated automatically while browsing directories he just switches to the custom view mode described in pre-previous post.
One must keep in mind that if tabs are not used (my case) then the only way to switch view mode is to select it from menu:
Show - Custom view modes.
The last question I have on this topic - is there a possibility to assign a hotkey or to create button for switching to custom view mode?
Posted: 2016-12-30, 01:18 UTC
by petermad
is there a possibility to assign a hotkey or to create button for switching to custom view mode
Use the command cm_SrcViewModeList <name of View mode> or for example cm_SrcViewMode1 for View mode number 1.
If you use cm_SrcViewModeList without any parameter a list of view modes is shown
Posted: 2016-12-30, 01:39 UTC
by ts4242
petermad wrote:2
ts4242
"[x] Automatically switch view mode on directory change:"
Setting this option without setting any Rule has no effect.
Automatic switch view mode works regardless if there is rule or not!
Posted: 2016-12-30, 08:00 UTC
by xrundel
petermad
Thank you!
Now the problem has complete solution.
Posted: 2016-12-30, 08:26 UTC
by petermad
Automatic switch view mode works regardless if there is rule or not!
Hmm, if I remove all my rules, and then set a View mode
manually, that mode stays on until I manually change it - nothing
automatic here... How would TC know when and how to change view without a rule?
Posted: 2016-12-31, 02:21 UTC
by ts4242
2
petermad
I select the option "[x] Automatically switch view mode on directory change:" to make TC execute "*cm_CountDirContent" on each directory change (note * in front of the command)
Maybe it is a bug, as according to TC help file, the command should executed within that view mode on each directory change but this doesn't happen if Automatically switch view mode is OFF
TC help wrote:Put a * in front of the commands to run them on each directory change to and within that view mode. Without the *, the commands are executed only when switching from a different view mode to this view mode.
Posted: 2016-12-31, 09:42 UTC
by petermad
2
ts4242
Aha, that makes sense that "[x] Automatically switch view mode on directory change:" has to be enabled to make the *-prefix have effect - thank you
