Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output of tree in command prompt

Tags:

tree

cmd

I was hoping to be able to use the

tree /F /A > "desktop"\file.txt 

command to output only text files. Currently as is, it outputs every file extension.

Does anyone know of an easy way to do this?

like image 547
trippedoutfish Avatar asked Jun 12 '12 20:06

trippedoutfish


People also ask

What is the output of tree command?

Upon completion of listing all files and directories found, tree returns the total number of files and directories listed. There are options to change the characters used in the output, and to use color output. The command is available in MS-DOS versions 3.2 and later and IBM PC DOS releases 2 and later.

What is tree command in command prompt?

The tree command allows users to view an easy-to-read list of files and folders.

Which is the output of command prompt?

Two important abstractions in Command Prompt are standard input and standard output. By default standard input is your keyboard, and standard output is your computer screen.


1 Answers

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 
like image 151
Ken White Avatar answered Sep 19 '22 08:09

Ken White