Sorting directories by size

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
xrundel
Junior Member
Junior Member
Posts: 16
Joined: 2016-12-24, 16:06 UTC
Location: Russia

Sorting directories by size

Post 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.
Last edited by xrundel on 2016-12-30, 07:49 UTC, edited 1 time in total.
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Showing directory sizes might finally be practical, now with the Everything integration.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post 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
xrundel
Junior Member
Junior Member
Posts: 16
Joined: 2016-12-24, 16:06 UTC
Location: Russia

Post 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).
User avatar
petermad
Power Member
Power Member
Posts: 16115
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post 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.
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
xrundel
Junior Member
Junior Member
Posts: 16
Joined: 2016-12-24, 16:06 UTC
Location: Russia

Post 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?
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post 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! :)
User avatar
petermad
Power Member
Power Member
Posts: 16115
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post 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)

________

2ts4242
"[x] Automatically switch view mode on directory change:"
Setting this option without setting any Rule has no effect.


2xrundel
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)
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
xrundel
Junior Member
Junior Member
Posts: 16
Joined: 2016-12-24, 16:06 UTC
Location: Russia

Post 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?
Last edited by xrundel on 2016-12-30, 08:01 UTC, edited 1 time in total.
User avatar
petermad
Power Member
Power Member
Posts: 16115
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post 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
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

petermad wrote:2ts4242
"[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!
xrundel
Junior Member
Junior Member
Posts: 16
Joined: 2016-12-24, 16:06 UTC
Location: Russia

Post by *xrundel »

petermad
Thank you!
Now the problem has complete solution.
User avatar
petermad
Power Member
Power Member
Posts: 16115
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post 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?
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

2petermad

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.
User avatar
petermad
Power Member
Power Member
Posts: 16115
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2ts4242

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 :-)
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply