Select Page

With that one line, nothing hides on your hard drive!

With that one line, nothing hides on your hard drive!

We will redirect the output of the ancient tree command to a text file and then change the ASCII-based character encoding so that the accented letters also display properly on our monitor. Let's cut into it!

With that one line, nothing hides on your hard drive!

Using the tree command to query the directory structure is not a vicious task at all, however, some “magic” is required to deal with accented characters as well.

The first command compiles a list of files in the directories (/ f) and saves them as a temp.txt file:

  • tree / f> temp.txt

The following snippet of code creates the file in question in Unicode encoding:

  • cmd / u / c type temp.txt> hoc.txt

You can now safely delete your temporary file:

  • del temp.txt

Finally, the whole command in one:

  • tree / f> temp.txt & cmd.exe / u / c type temp.txt> hoc.txt & del temp.txt

Of course, it is enough to use the last instruction, the codes preceding it are presented for the sake of clarity only. We recommend that our readers use Windows Explorer to access the folder they want to discover, and then start the command line (cmd) from the title bar. The instruction previously placed on the clipboard now only needs to be inserted, and the final result will appear in that folder in a few moments - this can take several seconds for a complex folder structure. If you don't want to list the files, only the folders, simply delete the / f switch after the tree - otherwise the process will be much faster.

About the Author