Skip to content

Instantly share code, notes, and snippets.

@joe-oli
Created January 17, 2020 01:24
Show Gist options
  • Save joe-oli/37bb1f55fcb141966623129c02887312 to your computer and use it in GitHub Desktop.
Save joe-oli/37bb1f55fcb141966623129c02887312 to your computer and use it in GitHub Desktop.
display only text files within parent folder and children
Tree accepts only a few command line parameters:
c:\>Tree /?
Graphically displays the folder structure of a drive or path.
TREE [drive:][path] [/F] [/A]
/F Display the names of the files in each folder.
/A Use ASCII instead of extended characters.
None of the indicated parameters are a file mask or filter.
You can use dir with the proper switches, and redirect the output to a text file. You'll get the full path name to the files, but you can filter that out in later processing if need be with a for loop:
C:\>dir *.txt /s /b > filelist.txt
----
It's actually not that hard to get your desired TREE output using FINDSTR regular expressions. :-)
tree /f /a | findstr /ri /c:"^[^| ]" /c:"^[| ]*[+\\]" /c:"\.txt$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment