Change directory color if specific subfolder is present

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
z9000
Junior Member
Junior Member
Posts: 4
Joined: 2018-02-27, 01:05 UTC

Change directory color if specific subfolder is present

Post by *z9000 »

Hi,

I can't figure out how to make the filter for coloring directories in this scenario:
Folder has the subfolder ".git"

I was looking for content plugins, but I can't find anything like this. Dirsizecalc is somewhat close, it can return a boolean if subdir is present but not a specific one.

Help would be appreciated.

Thank you!

PS: I use this file manager since around 96 and I love it, thanks for making it!
User avatar
tuska
Power Member
Power Member
Posts: 4046
Joined: 2007-05-21, 12:17 UTC

Define colors for folders/subfolders

Post by *tuska »

EDIT:
When considered again, the following is NOT, what you are looking for.
But I still leave the text here - maybe someone else can need it.
*********************************************************

Configuration > Options... > Color > Define colors by file type... > Add... > .git > Define... (Define selection)
Search for: *.git > switch to tab "Advanced" > tick "Attributes": > tick "Directory" (2x) > Save > Template name: *.git > OK > OK
choose color: e.g. red > OK > OK > OK

All folders* and subfolders with *.git in the name are automatically displayed in red.

*folders:
Unfortunately, I did not succeed in restricting to all subdirectories [using plugin "dirsizecalc"].

Note on coloring of folders/subfolders:
1. .git, a.git, abc.git -> color red is applied
2. abc.git-def, abc.gitdef -> No color is applied here

----
Unfortunately "Everything" can not be used here, e.g. ev:child:.git, since
ghisler(Author) wrote:'Everything' is not supported for colors by file type.
Reason: Total Commander does not search, he just compares the Folder names or their attributes with the specified search options.
Regards
Karl
Saaru
Junior Member
Junior Member
Posts: 14
Joined: 2019-06-21, 09:21 UTC

Re: Change directory color if specific subfolder is present

Post by *Saaru »

I am looking for the exact same functionality, did someone find a workaround in the mean time?
hi5
Power Member
Power Member
Posts: 637
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: Change directory color if specific subfolder is present

Post by *hi5 »

Assuming you have .gitignore files in your GIT main folder:

How to set up, two steps:

1: Configuration, View Modes:

Add, Add new view mode, give it a name, say "GitView"
Set tab color, tab icon, background colors and other preferences you may have

2: Configuration, View Modes, Auto Switch Mode:

Add

Two Rules (after setting D: Directory click more sub rules):

D: Directory
&
?At least one match, filetype: .gitignore

Set this mode: GitView

Apply, OK

Now each time you enter a folder with a .gitignore file in it you should see the colors you've set in GitView (step 1), when you leave the folder they should return to your default color settings.

(I couldn't get it to work with .GIT as directory instead of .gitignore as a file, apparently it doesn't work that way or I've made a mistake)
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Saaru
Junior Member
Junior Member
Posts: 14
Joined: 2019-06-21, 09:21 UTC

Re: Change directory color if specific subfolder is present

Post by *Saaru »

Thank you for the suggestion!
Apologies, I should have been more clear on what I'm looking for. I have a top-level directory where some subdirectories are git repositories, and some are not. While in the top-level directory I want to see the git directories marked differently from "regular" folders.

The provided suggestion changes the folder view when I am inside a git directory if I understand it correctly (unfortunately I could not get it to work properly as I failed in step 2 somehow).

However, this other post pointed me in the direction of the FileInDir plugin. With that I was able to do the following and achieve what I was looking for:
  • Install FileInDir plugin
  • Go to Configuration -> Color -> Define color by file type...
  • Add -> Define
  • In the Plugins tab of the search window select:
    • plugin: fileindir
    • property: DirSubdirs
    • OP: contains
    • value: .git
  • Press save and give this search template a name
  • Press OK and select a colour that foldernames that have a .git subdirectory should be shown in
The result: Image: https://i.imgur.com/M51Zfwb.png
hi5
Power Member
Power Member
Posts: 637
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: Change directory color if specific subfolder is present

Post by *hi5 »

Ah I see what you mean now, well everyone wins when reading this thread later - solutions for multiple setups :)
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Post Reply