Is there a way to display files count as column?
Moderators: white, Hacker, petermad, Stefan2
-
- New Member
- Posts: 1
- Joined: 2018-12-01, 12:55 UTC
Is there a way to display files count as column?
I want to add a custom column which will display files count in each directory.
I know there is a way to calculate size but of all directories by hitting Alt+Shift+Enter
I know there is a way to calculate size but of all directories by hitting Alt+Shift+Enter
Re: Is there a way to display files count as column?
Plugin DirSizeCalc delivers FileCount which you can use in a Custom Column definition.
But it shows the number of files in the whole tree below a given dir.
But it shows the number of files in the whole tree below a given dir.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
Re: Is there a way to display files count as column?
This is possible with Plugin DirSizeCalc 2.22 (a double click on the .zip-file installs the Plugin).artfabrique wrote: ↑2018-12-01, 13:00 UTC I want to add a custom column which will display files count in each directory.
I know there is a way to calculate size but of all directories by hitting Alt+Shift+Enter
but it is as Horst.Epp says: "But it shows the number of files in the whole tree below a given dir."
If you see the value: 0 (zero) in the column "Subdirectories" [=dirsizecalc.Directory Count] in the following user-defined column view,
then you will be shown the exact number of files for this folder (at least in this case it is the result you want).
Content of fields of "custom columns view..." (suggestion):
Code: Select all
[=dirsizecalc.File Count]
[=dirsizecalc.Directory Count]
[=dirsizecalc.Size.B]
[=tc.size.bkM2]
☑ Horizontal scrollbar
Optionally additional: View Mode + Auto Switch Mode to display the file sizes automatically [and immediately with "Everything"].
In this context it is recommended to integrate the program "Everything" and to change the settings
under Menu "Tools" - "Options..." - Indexes" --> tick the item "Index file size" and "Index folder size".
Additional information regarding Everything <-> TC can be found here: viewtopic.php?p=346372#p346372
Re: Is there a way to display files count as column?
2artfabrique
It can be done with WinScript Advanced plugin http://totalcmd.net/plugring/WinScriptAdv.html and AHK script
You can get AHK from https://autohotkey.com/download/
It can be done with WinScript Advanced plugin http://totalcmd.net/plugring/WinScriptAdv.html and AHK script
You can get AHK from https://autohotkey.com/download/
Code: Select all
#NoEnv
#NoTrayIcon
#SingleInstance, Force
Process, Priority, , A
SetBatchLines, -1
Content := ""
If InStr(FileExist(filename),"D")
{
Loop, Files, %filename%\*.*, F
{
Content++
}
}
Last edited by Ovg on 2018-12-02, 19:03 UTC, edited 1 time in total.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
#259941, TC 11.01 x64, Windows 7 SP1 x64
Re: Is there a way to display files count as column?
2Ovg
I'd like to try this, but unfortunately I don't know how to integrate the AHK script via the plugin into a user-defined column view.
I saved the code as a .AHK file and Autohotkey is installed. The plugin is also installed.
Please support.
Regards
Karl
I'd like to try this, but unfortunately I don't know how to integrate the AHK script via the plugin into a user-defined column view.
I saved the code as a .AHK file and Autohotkey is installed. The plugin is also installed.
Please support.
Regards
Karl
Re: Is there a way to display files count as column?
2tuska
Well. Let's go.
1. Let's assume that name of the file with ahk script is FilesCount.ahk (If no, change all occurrences of FilesCount with your actual filename)
2. Open file options.ini in WinScriptAdv plugin's directory in your preferred editor.
3. Find ActiveScripts key in [Script] section. Add |FilesCount to the end of line
eg
4. Find ahk key in [ExeScriptParsers] and change path to AutoHotkey.exe to your actual path
eg
5. Add to options.ini file following lines:
6. Save and close options.ini file
7. Copy FilesCount.ahk to Scripts directory in plugin's folder.
8. Restart TC
Now you should be able to choose Field FilesCount of WinScriptAdv plugin or simply add [=winscriptsadv.FilesCount] to Custom Column.
It seems that's all.
HTH
Well. Let's go.
1. Let's assume that name of the file with ahk script is FilesCount.ahk (If no, change all occurrences of FilesCount with your actual filename)
2. Open file options.ini in WinScriptAdv plugin's directory in your preferred editor.
3. Find ActiveScripts key in [Script] section. Add |FilesCount to the end of line
eg
Code: Select all
[Script]
ActiveScripts=MinutesAgo|CheckEncoding|Signature|FilesCount
eg
Code: Select all
[ExeScriptParsers]
ahk=c:\Program Files\AutoHotkey\AutoHotkey.exe
Code: Select all
[FilesCount]
Script = FilesCount.ahk
content = FilesCount
extensions = *
FoldersPaths = 1
7. Copy FilesCount.ahk to Scripts directory in plugin's folder.
8. Restart TC
Now you should be able to choose Field FilesCount of WinScriptAdv plugin or simply add [=winscriptsadv.FilesCount] to Custom Column.
It seems that's all.
HTH
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
#259941, TC 11.01 x64, Windows 7 SP1 x64
Re: Is there a way to display files count as column?
2Ovg
Thank you for your perfect tutorial!
I could set everything up and it works!
Confusing for me at the beginning was the fact that the number also contained hidden files (descript.ion, Thumbs.db).
This could be cleared up however with the command: cm_SwitchHidSys.
Regards
Karl
EDIT:
Now I have created a button with command: cm_SrcCustomView5 (5=No. from the user defined column view)
Thank you for your perfect tutorial!
I could set everything up and it works!
Confusing for me at the beginning was the fact that the number also contained hidden files (descript.ion, Thumbs.db).
This could be cleared up however with the command: cm_SwitchHidSys.
Regards
Karl
EDIT:
Now I have created a button with command: cm_SrcCustomView5 (5=No. from the user defined column view)
Last edited by tuska on 2018-12-02, 18:40 UTC, edited 1 time in total.
Re: Is there a way to display files count as column?
2tuska
You are welcome!
From AHK help
... All matching files are retrieved, including hidden files. By contrast, OS features such as the DIR command omit hidden files by default. To avoid processing hidden, system, and/or read-only files, use something like the following inside the loop:
You are welcome!
From AHK help
... All matching files are retrieved, including hidden files. By contrast, OS features such as the DIR command omit hidden files by default. To avoid processing hidden, system, and/or read-only files, use something like the following inside the loop:
Code: Select all
if A_LoopFileAttrib contains H,R,S ; Skip any file that is either H (Hidden), R (Read-only), or S (System). Note: No spaces in "H,R,S".
continue ; Skip this file and move on to the next one.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
#259941, TC 11.01 x64, Windows 7 SP1 x64
Re: Is there a way to display files count as column?
2Ovg
For me it would be interesting NOT to consider the hidden files in the number of files.
Could you please change your code according to this criterion and announce it here?
Just by the way:
With the button with command: cm_SrcCustomView42 I ran again into the problem that only at most the
command: cm_SrcCustomView29 is permitted, provided that you have an entry in the TOTALCMD.INC up from cm_SrcCustomView10.
Therefore I moved this user defined view to the top, i.e. to no. 5 -> cm_SrcCustomView5 (see above).
EDIT:
This also led to a problem with an existing button. The command had to be changed from cm_SrcCustomView8 to cm_SrcCustomView14!
Further surprises cannot be ruled out...
A button with command: cm_SrcViewMode0 sets the user defined view back to "Default".
For me it would be interesting NOT to consider the hidden files in the number of files.
Could you please change your code according to this criterion and announce it here?
Just by the way:
With the button with command: cm_SrcCustomView42 I ran again into the problem that only at most the
command: cm_SrcCustomView29 is permitted, provided that you have an entry in the TOTALCMD.INC up from cm_SrcCustomView10.
Therefore I moved this user defined view to the top, i.e. to no. 5 -> cm_SrcCustomView5 (see above).
EDIT:
This also led to a problem with an existing button. The command had to be changed from cm_SrcCustomView8 to cm_SrcCustomView14!
Further surprises cannot be ruled out...
A button with command: cm_SrcViewMode0 sets the user defined view back to "Default".
Last edited by tuska on 2018-12-04, 01:37 UTC, edited 1 time in total.
Re: Is there a way to display files count as column?
2tuska
What do you mean Hidden?
Hidden = Hidden + System or only Hidden?
What do you mean Hidden?
Hidden = Hidden + System or only Hidden?
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
#259941, TC 11.01 x64, Windows 7 SP1 x64
Re: Is there a way to display files count as column?
Code: Select all
Hidden + System
(Everything should be hidden which can only be shown separately, e.g. with command: cm_SwitchHidSys.)
Re: Is there a way to display files count as column?
2tuska
New script:
Change section [FilesCount] in options.ini
Save options.ini and restart TC
Change your custom column to [=winscriptsadv.FilesCount_No_System_Hidden]
New script:
Code: Select all
#NoEnv
#NoTrayIcon
#SingleInstance, Force
Process, Priority, , A
SetBatchLines, -1
;filename =%1%
Content := Content1 := ""
If InStr(FileExist(filename),"D")
{
Loop, Files, %filename%\*.*, F
{
Content1++
if A_LoopFileAttrib not contains H,S
{
Content++
}
}
}
Code: Select all
[FilesCount]
Script = FilesCount.ahk
content = FilesCount_NO_System_Hidden
content1 = FilesCount_All
extensions = *
FoldersPaths = 1
Change your custom column to [=winscriptsadv.FilesCount_No_System_Hidden]
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
#259941, TC 11.01 x64, Windows 7 SP1 x64
Re: Is there a way to display files count as column?
2Ovg
Thanks a lot, it works great!
I have now opted for these fields in the 'Custom column view', to get a good overview of the content of the folders:
Custom column view: FilesCount_NO-HS_Subdirs_Size
Thanks again!
Thanks a lot, it works great!
I have now opted for these fields in the 'Custom column view', to get a good overview of the content of the folders:
Custom column view: FilesCount_NO-HS_Subdirs_Size
Code: Select all
FilesCount SH [=winscriptsadv.FilesCount_NO_System_Hidden]
Subdirectories [=dirsizecalc.Directory Count]
Size (bytes) [=dirsizecalc.Size.B]
Last Change [=tc.writedate.D.M.Y h:m]
Attribute [=tc.attributestr]
Re: Is there a way to display files count as column?
2tuska
Thanks for feedback! I'm glad that it's working for you.
Thanks for feedback! I'm glad that it's working for you.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
#259941, TC 11.01 x64, Windows 7 SP1 x64