Save result data command tree [closed]

I need to save all of the results of the command tree in a txt file. The objective is to save this data in a data base for later work in php and html.

The main objective is to expose the structure on a web page to determine the structure of the folders.

How can I do this? Any ideas?

Update I found this command on Ask Ubuntu: tree > result.list. It's possible to save the data and result of the command tree to a text file. But, do you have any idea how I can use and read on environment web?


All you have to do is run the following command:

tree -H ./ > result.html

The first part of this command, tree -H ./ will run the tree command and will export the output in HTML format by using the option or "flag", -H ./ . The next part, > result.html will save the output to a file named result.html.

The file will be saved to your current directory.

To view the html page using firefox, run the following command:

firefox ./result.html

Using ./ specifies the current directory because that is where the file has been saved.


How did I figure this out?

I ran the following command:

tree --help

Then, I looked for HTML and I saw there was an option for HTML so I used it and sure enough, it worked.

You can pretty much run any command along with the --help flag to see how to use the command.

You can also view the manual for most applications by using the man command like this:

man tree

The info that you discovered shows a command that uses redirection (>). This command will send the results of the tree command to a file that you name in the command (result.list). This file can be any name that you determine. This file will be saved in the current directory you are working in unless you type a different path as part of the file name. You can then open this file in your favorite text editor (gedit,vi,emacs) and then do whatever you need with it or to it. Attaching this file to web applications/environments simply requires that you know where the file is and that path is used for attaching purposes.

            Hope this helps Craig