Color code a folder if specific file is inside

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
toxygen535
Junior Member
Junior Member
Posts: 4
Joined: 2022-01-12, 12:56 UTC

Color code a folder if specific file is inside

Post by *toxygen535 »

Can I color code a folder based by a specific file (or just a file name) inside that folder? Let's say I have three folders, two of which contain DONE.txt file. Can those folders with DONE.txt inside be color coded by a specific color and the one without remain uncolored, just black on white?
Thanks in advance!
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Color code a folder if specific file is inside

Post by *Stefan2 »

Yes

See e.g. "Color highlight a file (or folder) by any of its properties" at
https://ghisler.ch/board/viewtopic.php?p=352014#p352014






 
toxygen535
Junior Member
Junior Member
Posts: 4
Joined: 2022-01-12, 12:56 UTC

Re: Color code a folder if specific file is inside

Post by *toxygen535 »

Stefan2 wrote: 2022-01-12, 13:30 UTC Yes

See e.g. "Color highlight a file (or folder) by any of its properties" at
https://ghisler.ch/board/viewtopic.php?p=352014#p352014
I'm glad that it can be done!
But I'm pretty new to TC and didn't really understood how do I define that exact thing.
I can color code specific files or folders but cannot find how do I color code folders that include X file.
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Color code a folder if specific file is inside

Post by *nsp »

You can use EmptyWDX 0.0.3 or FileInDir 64bit and create a specific filter for done.txt
ex for emptyWdx

Code: Select all

[WDXContains]
1_filter=done.txt
1_type=0
1_Name=done-txt
1_Max=1
ex for FileInDir

Code: Select all

[done-txt]
SearchFile=done.txt
you can then colorize folder using the wdx plugin..
Go to configuration -> Color -> [Define Color by FileType]

Create a search type
go to plugins tab chose EmptyWdx or FileInDir + done-txt + = + YES
save as done-txt
then chose the color you want !
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Color code a folder if specific file is inside

Post by *Stefan2 »

toxygen535 wrote: 2022-01-12, 13:57 UTC But I'm pretty new to TC and didn't really understood how do I define that exact thing.
I can color code specific files or folders but cannot find how do I color code folders that include X file.

Ahh, right, I think I didn't have documentet that part yet.

But user nsp also has a good alternatives.

I know, at start that all can gone quickly overwhelmed, so just ask if something is unclear (find some faq collections via my sig).






Here is a way via a script plugin ( I have tested that with "script_wdx" onlym but should work with "WinScript" the same way)



1)You need a plugin like http://www.totalcmd.net/plugring/script_wdx.html (this is TC 32-bit only)
or viewtopic.php?t=44032 --[wdx] WinScript Advanced Content Plugin (x86\x64) (new)
((( PLUGINs - Find / Installing / Removing a plugin: https://ghisler.ch/board/viewtopic.php?p=294671#p294671 )))


- create a script like this "containsfile.vbs" and save in folder of "script_wdx" -plugin:

Code: Select all

'// borrowed by Mr. Ghisler: https://ghisler.ch/board/viewtopic.php?p=284870#p284870
find="DONE.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
find=LCase(find)
l=Len(find)
If (fso.FolderExists(filename)) Then
  Set fld = fso.GetFolder(filename)
  Set fc = fld.Files
  content = 0
  For Each fil in fc
    If (LCase(fil.Name)=find) Then
      content = 1
    End If
  Next
Else
  content = 2
End If
(((EDIT: script do not search in sub-folders yet, we can add that, if need)))


- modify the script.ini from "script_wdx" -plugin

Code: Select all

[Script]
Section=containsfile

[containsfile]
Script=Scripts\containsfile.vbs
LongName=1
ParseDirs=1



2) TC Menu Commands > Search
Search for:
Search in:
[Plugins]
script | Result | = | 1

[Load/Save]
[Save]
Save as: search_Find_DONE.txt
[Cancel] the search dialog




3) TC Menu Configuration > Options...
Color
Click at "[x] [Define colors by file type...]"
[Add...]
Select your "search_Find_DONE.txt"
[OK]
choose Color
[OK]
[OK]
[OK]



Now the folders containing a file named "DONE.txt" are colored in your choosen color.



HTH? :D
toxygen535
Junior Member
Junior Member
Posts: 4
Joined: 2022-01-12, 12:56 UTC

Re: Color code a folder if specific file is inside

Post by *toxygen535 »

Thanks a lot to both of you!

For some reason only FileInDir worked for me. Tried with script_wdx and couldn't figure out how everything should work.

Again big thanks, I really appreciate your help!
Post Reply