Suppose we need to find out quickly what all sub directories with their files are under a directory without going to Windows explorer to do that or even using the dir command.Is it possible?
Yes indeed.We can find out the details from the beloved command prompt using the “tree”.
This command comes in handy when we want to list only a particular file or similar file types from a lot of files under some directory.
Let’s take a look to clarify this :
1.Like most online users,I download a lot of stuff,finding what I want in the default Downloads folder can be a pain sometimes.
2.Let’s say I want to find out if I have downloaded some .txt files in Downloads folder.(Of course the graphical way here would be to double click Downloads folder and then list files by type or by doing a cd to that directory and then listing file type with wildcards,but remember we want to complete this just from the command prompt with least effort and from the current directory we are in).
3.I launch the command prompt (Start>Run>cmd).
4.Tree comes into play – listing the path I want to scan files for (C:UsersAVPDownloads) in this case with the /f switch in command prompt to list all the files too within the sub directories.
5.Since I want to see if I have any text files that I had downloaded recently,the next step would be to use find command to filter our output so that files with only the .txt extension will be listed.
The command which will do all of the above will be :
C:UsersAVPDownloads>tree “c:UsersAVPDownloads”
/f|find “.txt”
I see the following output once I give the above command :
As seen tree can be very useful,I will give one more example to make this clear.
Suppose I want to see what files I have within a nested sub folder of a main folder from the command prompt.
Here is what I do :
Hope this has been an informative post.
Peace.

