File Tree Diagram as Text

English support forum

Moderators: white, sheep, Hacker, Stefan2

Post Reply
leo007
Junior Member
Junior Member
Posts: 31
Joined: 2019-10-28, 08:09 UTC

File Tree Diagram as Text

Post by *leo007 »

Hi Everyone,

is there a way to show File Tree Diagram in TC as simple text entry that can easily copied?
like in CMD.

below CMD Visual illustration

Code: Select all


d:\\Music>tree /A /F
Folder PATH listing for volume Local Disk
Volume serial number is 78D9-BF4B
D:.
\---Pantera
    +---1990 - Cowboys From Hell
    |       Cemetary Gates.mp3
    |       Cowboys From Hell.mp3
    |       Domination.mp3
    |       Psycho Holiday.mp3
    |       Shattered.mp3
    |
    +---1992 - Vulgar Display Of Power
    |       Fucking Hostile.mp3
    |       Hollow.mp3
    |       Mouth For War.mp3
    |       Piss.mp3
    |       This Love.mp3
    |       Walk.mp3
    |
    +---1994 - Far Beyond Driven
    |       5 Minutes Alone.mp3
    |       I'm Broken.mp3

Thanks in advance
User avatar
Dalai
Power Member
Power Member
Posts: 7833
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: File Tree Diagram as Text

Post by *Dalai »

TC doesn't do something like this. But if you already know about the tree command, you can use it, even on a button in the TC button bar or in TC's start menu.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups - Download-Mirror
leo007
Junior Member
Junior Member
Posts: 31
Joined: 2019-10-28, 08:09 UTC

Re: File Tree Diagram as Text

Post by *leo007 »

Dalai Thanks for your Reply
Dalai wrote: 2019-11-23, 22:23 UTC But if you already know about the tree command, you can use it, even on a button in the TC button bar or in TC's start menu.
you mean Commands ⟶ CD Tree.. ?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4580
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: File Tree Diagram as Text

Post by *Horst.Epp »

leo007 wrote: 2019-11-24, 04:31 UTC Dalai Thanks for your Reply
Dalai wrote: 2019-11-23, 22:23 UTC But if you already know about the tree command, you can use it, even on a button in the TC button bar or in TC's start menu.
you mean Commands ⟶ CD Tree.. ?
I guess he means the DOS command Tree.
Windows 11 Home x64 Version 21H2 (OS Build 22000.318)
TC 10.00 x64 / x86
Everything 1.5.0.1286a (x64)
leo007
Junior Member
Junior Member
Posts: 31
Joined: 2019-10-28, 08:09 UTC

Re: File Tree Diagram as Text

Post by *leo007 »

Horst.Epp wrote: 2019-11-24, 09:38 UTC
leo007 wrote: 2019-11-24, 04:31 UTC Dalai Thanks for your Reply
Dalai wrote: 2019-11-23, 22:23 UTC But if you already know about the tree command, you can use it, even on a button in the TC button bar or in TC's start menu.
you mean Commands ⟶ CD Tree.. ?
I guess he means the DOS command Tree.
ok got it.
I made a button in Total Commander button bar
https://i.imgur.com/GCt680Z.png

how could I pass entry?

Code: Select all

Tree /A /F  %Current_location% 
User avatar
tuska
Power Member
Power Member
Posts: 2597
Joined: 2007-05-21, 12:17 UTC

Re: File Tree Diagram as Text

Post by *tuska »

Based on this thread I have this button:

Code: Select all

TOTALCMD#BAR#DATA
cmd /c tree /f /a > "_TREE-Output.txt"

%COMMANDER_EXE%,2
cmd /c tree /f /a > "_TREE-Output.txt"  ||  tree view (--> .txt)|https://ghisler.ch/board/viewtopic.php?f=3&t=52809

0
-1
You can use the code to create a button as follows:
1. Click on "SELECT ALL" (to the right of CODE:)
2. CTRL + C = Copy to clipboard (press the CTRL-key and hold it down, then press the letter "C")
3. Make a right click on your buttonbar on an empty space [e.g. after the last button or between the buttons]
4. Click on menu item "Paste"
5. [Option: Point to the new button (slightly longer): 'Tooltip' is shown (-> description to the button)]

Unfortunately, the current path is not written to the .txt file here.
This path could be found after executing

Code: Select all

cm_CopySrcPathToClip	2029	Copy source path to clipboard
and entered manually in the 3rd line of _TREE-Output.txt.
leo007
Junior Member
Junior Member
Posts: 31
Joined: 2019-10-28, 08:09 UTC

Re: File Tree Diagram as Text

Post by *leo007 »

tuska Thanks for your Reply

I already made a script

Code: Select all

  !t:: ; POWERSHELL FILE TREE DIAGRAM
    Send, ^c
    Sleep 100
    Clipboard := Clipboard
    Run, powershell
    Sleep, 50
    Send, Tree {U+002F}F{SPACE}{U+0022}^v{U+0022}{Enter}
    Return
but I really like how your code works. and its much more efficient then what I was planing on the first place)
could you please answer or correct my understanding comments related to your code please?

TOTALCMD#BAR#DATA ; make relation between button and main Button bar
cmd /c tree /f /a > "_TREE-Output.txt" ; run cmd tree command. what does "/c" and ">" related to?
%COMMANDER_EXE%,2 ; icon selection
cmd /c tree /f /a > "_TREE-Output.txt".... ; tooltip entry

0 ; What the meaning of this line?
-1 ; What the meaning of this line?
User avatar
tuska
Power Member
Power Member
Posts: 2597
Joined: 2007-05-21, 12:17 UTC

Re: File Tree Diagram as Text

Post by *tuska »

It's not "my" code (I'm just a user/not a programmer and use this code).

I'm trying here to translate the explanation to TOTALCMD#BAR#DATA (German) by Stefan2:

Code: Select all

Line 1: This allows TC to recognize this code in the clipboard and to show the 'Paste' entry in the buttonbar context menu.
Line 2: The command
Line 3: The parameters for the command (the leading '?' causes the command to be displayed when executing)
Line 4: Path to the file of the icon
Line 5: The tooltip
Line 6: The start path
Line 7: Call parameter minimized as icon / maximized (usercmd.ini: iconic)
Line 8: The number of the internal TC command if line 2 contains one, otherwise '-1' for other commands.
leo007 wrote:what does "/c" and ">" related to?

"/c"
1. Open a DOS box, for example, as follows:
    Enter cmd in the TC command line, then press <enter>
2. Type in: cmd /? ... then press <enter>
3. A list of parameters is displayed - an explanation for parameter /C is at the very beginning.
    For me, the following is displayed here: "Executes the command in the string and then ends"
4. Type in: exit ... then press <enter> -> closes the DOS window
">"
I think that's a pipe symbol in this case that redirects the result of "tree /F /A" into a text file.
leo007
Junior Member
Junior Member
Posts: 31
Joined: 2019-10-28, 08:09 UTC

Re: File Tree Diagram as Text

Post by *leo007 »

tuska Thank you very much for sharing great code and for your explanation)
Post Reply