Generate html based on directory structure

12

4

does any one knows a linux based program/script that can generate html files based on directory structure?

TusharG

Posted 2010-07-22T18:35:12.793

Reputation: 1 352

@Phoshi, someone noted in a soon/now deleted answer: "makeIndex2.py doesnt work because it uses a reserved word with that cannot be used in the way the script was written". That said, maybe you can post the script as an answer here? Links go dead. – Arjan – 2015-08-23T17:07:11.253

I made my own in python to index my Dropbox public folder. It wasn't very hard. (http://dl.dropbox.com/u/2502059/index.html if you want to see. The script that generated it is makeIndex2.py under /Python Scripts.)

– Phoshi – 2010-07-22T18:55:00.110

Thanks! That helps a lot. I can get the concept from your script. – TusharG – 2010-07-22T20:05:19.877

Answers

28

Some versions of tree, which is a common utility, can produce HTML output.

tree -H baseHREF

Paused until further notice.

Posted 2010-07-22T18:35:12.793

Reputation: 86 075

6I learn something new everyday here. – steve.lippert – 2010-07-22T21:05:58.813

Hey Dennis Thanks a lot. Your answer is closest and easiest to deploy. I wasn't aware tree command is so powerful. – TusharG – 2010-07-23T02:53:35.887

For Mac OS https://rschu.me/list-a-directory-with-tree-command-on-mac-os-x-3b2d4c4a4827

– Harshul Pandav – 2018-07-20T18:53:18.307

Unfortunately this isn't available on the Windows tree command I have. – jamiebarrow – 2011-08-04T07:56:20.427

2@jamiebarrow: The question is tagged [tag:linux]. – Paused until further notice. – 2011-08-07T03:06:32.160

Yes I know, hence 'Unfortunately' ... :) The -H switch isn't available for me, on Windows. I do have the tree command. I think via one of the GNU core utils packages. – jamiebarrow – 2011-08-08T09:32:25.597

I was looking for something like this though, for now I was just thinking of doing tree /f /a>listing.txt and take the output and write some custom tool to generate the HTML, but was hoping I could be lazy and not have to write that tool. – jamiebarrow – 2011-08-08T09:35:51.363

1

@jamiebarrow: Windows includes its own tree command. If you also have a GNU version, you should be able to upgrade to a version that supports -H.

– Paused until further notice. – 2011-08-11T22:23:38.613