# Directory Tree --\> HTML

**URL:** https://boards.straightdope.com/t/directory-tree-html/428956
**Category:** Factual Questions
**Created:** [December 5, 2007, 9:47pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956 "2007-12-05T21:47:44Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Will\_Repair](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@Will\_Repair](https://boards.straightdope.com/u/Will_Repair)
#### Post date: [December 5, 2007, 9:47pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/1 "2007-12-05T21:47:44Z")

</div>

I asked the question [once before](http://boards.straightdope.com/sdmb/showthread.php?t=443217) but I did not make my question plain enough. So, again…

I have a list of files on several CD-ROMs and a DVD that I would like to make available for my customers to download from my website. I already have a directory that is password protected.

My next step is to, using the public library computer, put a CD-ROM into the drive and have a program read the drive and produce an HTML file listing those files. I’ll name the file /password protected directory/index.html. I may have to tweak this file somewhat but that can be done using Wordpad’s search and replace function and saving as text then renaming .html.

Now the biggest obstacle is that using public computers I am not allowed to install software. However I have a USB 1G drive, so the program must be self standing.

I’ve tried a bat file with [command.com](http://command.com) but it won’t allow the use of long filenames and the admin has disabled [cmd.com](http://cmd.com) so using cd, dir, and tree are out.

I’m starting my search over again, a little more systematically keeping copies of the names of programs that don’t work.

So, anyone know of a stand alone program that will read a drive and produce an html file listing the files with size and parent directory?

---

<div class="post-metadata">

### Author: ![dmatsch](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@dmatsch](https://boards.straightdope.com/u/dmatsch)
#### Post date: [December 5, 2007, 9:59pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/2 "2007-12-05T21:59:23Z")

</div>

re-read your post. Since cmd is disabled, you cant do this:

dir _._ \> output.htm

---

<div class="post-metadata">

### Author: ![Will\_Repair](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@Will\_Repair](https://boards.straightdope.com/u/Will_Repair)
#### Post date: [December 5, 2007, 10:06pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/3 "2007-12-05T22:06:44Z")

</div>

[QUOTE=dmatsch]  
dir _._ \> output.htm  
[/QUOTE]  
Access Denied.

Can one evoke a cmd shell within a command shell?

No, just a longer error message. But I’ll try on another computer. There is no consistency in the setup of Windows.

---

<div class="post-metadata">

### Author: ![Terminus\_Est](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/terminus_est/32/3087_2.png) [@Terminus\_Est](https://boards.straightdope.com/u/Terminus_Est)
#### Post date: [December 5, 2007, 10:16pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/4 "2007-12-05T22:16:56Z")

</div>

Didn’t you get my PM?

---

<div class="post-metadata">

### Author: ![MrSquishy](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@MrSquishy](https://boards.straightdope.com/u/MrSquishy)
#### Post date: [December 5, 2007, 10:18pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/5 "2007-12-05T22:18:55Z")

</div>

On my machine, I can run cmd from command from cmd, if that helps at all.

Is the Access Denied when you’re running the local command/cmd.com on the library computer? Have you tried putting [cmd.com](http://cmd.com) on your USB stick and running it from there? Forgive me if this is a stupid idea for some reason; it’s been a long time since I had to do very much from the Windows command prompt.

This may be totally against the library’s usage policy, but how about some kind of Linux live boot from CD or USB?

---

<div class="post-metadata">

### Author: ![Terminus\_Est](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/terminus_est/32/3087_2.png) [@Terminus\_Est](https://boards.straightdope.com/u/Terminus_Est)
#### Post date: [December 5, 2007, 10:25pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/6 "2007-12-05T22:25:48Z")

</div>

Missed the edit window:

Your ISP has settings that will allow this without your having to run any scripts. Check your message box, where I sent you instructions on how to do this.

---

<div class="post-metadata">

### Author: ![MrSquishy](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@MrSquishy](https://boards.straightdope.com/u/MrSquishy)
#### Post date: [December 5, 2007, 10:26pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/7 "2007-12-05T22:26:34Z")

</div>

Now that I’ve read your other thread, if I understand what it is you’re trying to accomplish (and I’m not sure I do), I think you got the answers over there. As mentioned in that other thread, can’t you get your web host to turn on auto-indexing for your website? Or, if you can use .htaccess files for password protection, maybe you can turn on auto-indexing in the .htaccess file (assuming the autoindex module is loaded, which I bet it is).

On preview, it looks like **Terminus Est** is on the case, and it sounds like (s)he and I are thinking the same way.

---

<div class="post-metadata">

### Author: ![Will\_Repair](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@Will\_Repair](https://boards.straightdope.com/u/Will_Repair)
#### Post date: [December 5, 2007, 10:53pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/8 "2007-12-05T22:53:40Z")

</div>

**Terminus Est** , found your message. htaccess is disabled but strangely enough is that I have a password protected directory with a Netfirms generated .htaccess file.

**MrSquishy** Auto-Indexing? Is there where someone goes to [Domain.com Community Directory](http://www.domain.com/directory) and their browser lists the files in that directory. If so, is there a command in the htaccess file that would allow this for only one directory?

Hmm, even though I use my website as backup for my USB drive I could backup in another, my own, password protected directory… Hmm, and that would make my Poison Spammers File public too.

Anyway, this sounds, if I understand correctly, like the best solution. If a customer could go to a directory and see all the files themselves would save me a lot of work and with only an hour a day allowed on the library computer a quick solution.

Times up. Gotta go. Check in Friday, Thursday is Monday Night Football day.

---

<div class="post-metadata">

### Author: ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)
#### Post date: [December 6, 2007, 12:57am UTC](https://boards.straightdope.com/t/directory-tree-html/428956/9 "2007-12-06T00:57:47Z")

</div>

I haven’t worked with Linux Web servers in a long time…but can’t he use CHMOD via FTP to change the directory to browseable? (777 I think?)

Or am I remembering something from Computing 1982?

---

<div class="post-metadata">

### Author: ![Punoqllads](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@Punoqllads](https://boards.straightdope.com/u/Punoqllads)
#### Post date: [December 6, 2007, 1:17am UTC](https://boards.straightdope.com/t/directory-tree-html/428956/10 "2007-12-06T01:17:18Z")

</div>

Httpd has a hierarchical permissions system layered on top of the Unix filesystem. Merely changing directory permissions would not be sufficient.

---

<div class="post-metadata">

### Author: ![Terminus\_Est](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/terminus_est/32/3087_2.png) [@Terminus\_Est](https://boards.straightdope.com/u/Terminus_Est)
#### Post date: [December 6, 2007, 1:19am UTC](https://boards.straightdope.com/t/directory-tree-html/428956/11 "2007-12-06T01:19:44Z")

</div>

[QUOTE=Will Repair]  
**Terminus Est** , found your message. htaccess is disabled but strangely enough is that I have a password protected directory with a Netfirms generated .htaccess file.

[/quote]

Yes, you need to enable it via the procedure given by your ISP.

> [@](#):
>
> **MrSquishy** Auto-Indexing? Is there where someone goes to [www.domain.com/directory](http://www.domain.com/directory) and their browser lists the files in that directory. If so, is there a command in the htaccess file that would allow this for only one directory?

Yes and yes. You specify the directory in the htaccess file.

> [@ZipperJJ](#):
>
> I haven’t worked with Linux Web servers in a long time…but can’t he use CHMOD via FTP to change the directory to browseable? (777 I think?)
> 
> Or am I remembering something from Computing 1982?

chmod doesn’t work via FTP. You need shell access to do that. In any event, you still need to get the webserver to agree to display a directory listing.

---

<div class="post-metadata">

### Author: ![Punoqllads](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@Punoqllads](https://boards.straightdope.com/u/Punoqllads)
#### Post date: [December 6, 2007, 1:27am UTC](https://boards.straightdope.com/t/directory-tree-html/428956/12 "2007-12-06T01:27:15Z")

</div>

[QUOTE=Terminus Est]  
chmod doesn’t work via FTP. You need shell access to do that. In any event, you still need to get the webserver to agree to display a directory listing.  
[/QUOTE]  
Both ftp and sftp allow the user to change file permissions if they are connected as the owner of that file.

---

<div class="post-metadata">

### Author: ![Terminus\_Est](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/terminus_est/32/3087_2.png) [@Terminus\_Est](https://boards.straightdope.com/u/Terminus_Est)
#### Post date: [December 6, 2007, 8:11pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/13 "2007-12-06T20:11:10Z")

</div>

[QUOTE=Punoqllads]  
Both ftp and sftp allow the user to change file permissions if they are connected as the owner of that file.  
[/QUOTE]

Ah, you are correct - although chmod capability is dependent on the ftp client. Modern \*nix clients allow you to do this. Windows clients, not so much.

---

<div class="post-metadata">

### Author: ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)
#### Post date: [December 6, 2007, 8:27pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/14 "2007-12-06T20:27:58Z")

</div>

[QUOTE=Terminus Est]  
Ah, you are correct - although chmod capability is dependent on the ftp client. Modern \*nix clients allow you to do this. Windows clients, not so much.  
[/QUOTE]

I dunno, I just checked in my CoreFTP app (a free FTP client for Windows) and I can connect to a remote location and right-click on a folder or file then choose “properties” and set perms there.

Now that I think about it, you have to be able to do this when you do things like set up Wordpress or vBulletin, so I would assume this is a standard feature.

And furthermore, since it works with Wordpress and vBulletin (for write perms, at least), no matter how deep the directories are, one would think that the hierarchy is inferred when setting up “browse” options. But that’s just a guess.

It wouldn’t hurt for him to try.

---

<div class="post-metadata">

### Author: ![MrSquishy](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@MrSquishy](https://boards.straightdope.com/u/MrSquishy)
#### Post date: [December 6, 2007, 11:22pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/15 "2007-12-06T23:22:37Z")

</div>

I’m not sure what S/FTP has to do with this. I think **Will Repair** is looking for an HTTP solution, judging from his mention of HTML files.

For the following, I’m assuming based on what I’ve read so far that your web server is Apache-powered. If you’re using IIS, I can’t help you (or maybe I should say “God help you”).

If .htaccess files are allowed on your web server, I think you’re in business. If you are already doing something (your authentication stuff?) via an .htaccess file, you’re good to go. If they’re not, they can be enabled with AllowOverride in a \<Directory\> context. If you can’t modify the Apache config for your virtual host, and AllowOverride isn’t set, you might be out of luck unless you can get your web hosting company to turn it on for you.

([Here](http://httpd.apache.org/docs/2.0/howto/htaccess.html) is some documentation that might help with .htaccess file concepts)

Once you’ve got .htaccess files working, all you need to do is add this to the .htaccess where you have your authentication mechanism set up (presumably in the directory you’ve password-protected):

```auto

Options +Indexes

```

Described [here](http://httpd.apache.org/docs/2.0/mod/core.html#options), “+Indexes” will enable indexes:

[QUOTE=Apache2 documentation]  
If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod\_autoindex will return a formatted listing of the directory.  
[/QUOTE]

I believe that is exactly what you want, assuming I’m understanding the question correctly.

If there is already an “Options” directive with other options, just tack a space and then “+Indexes” on the end.

There is a bunch of fancy advanced stuff you can do if mod\_autoindex is loaded in Apache. [Here](http://httpd.apache.org/docs/2.0/mod/mod_autoindex.html) is the documentation for mod\_autoindex. Even if mod\_autoindex isn’t loaded, though, I think all of the above still applies (I didn’t realize in my earlier response when I was talking about autoindexes that “Options +Indexes” is a core feature, i.e. doesn’t require any other modules).

I hope this helps.

---

<div class="post-metadata">

### Author: ![GuanoLad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/guanolad/32/42_2.png) [@GuanoLad](https://boards.straightdope.com/u/GuanoLad)
#### Post date: [December 6, 2007, 11:40pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/16 "2007-12-06T23:40:51Z")

</div>

You guys seem to be going way over technical for something that seems pretty straightforward.

He wants a text list of the files on his CD collection to add to his webpage.

---

<div class="post-metadata">

### Author: ![Terminus\_Est](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/terminus_est/32/3087_2.png) [@Terminus\_Est](https://boards.straightdope.com/u/Terminus_Est)
#### Post date: [December 6, 2007, 11:55pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/17 "2007-12-06T23:55:28Z")

</div>

[QUOTE=GuanoLad]  
You guys seem to be going way over technical for something that seems pretty straightforward.

He wants a text list of the files on his CD collection to add to his webpage.  
[/QUOTE]

No, he wants a list of files _so people can download them_ from his webpage. This is pretty straightforward, but requires cooperation from the web server. I have already responded via PM, with appropriate links to the support pages of the OP’s web hosting provider.

---

<div class="post-metadata">

### Author: ![GuanoLad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/guanolad/32/42_2.png) [@GuanoLad](https://boards.straightdope.com/u/GuanoLad)
#### Post date: [December 7, 2007, 12:00pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/18 "2007-12-07T12:00:21Z")

</div>

But he wants to do this from a library terminal, keeping the files on CD. That sounds like a really bad way to even start.

---

<div class="post-metadata">

### Author: ![Will\_Repair](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@Will\_Repair](https://boards.straightdope.com/u/Will_Repair)
#### Post date: [December 7, 2007, 4:01pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/19 "2007-12-07T16:01:31Z")

</div>

[QUOTE=GuanoLad]  
But he wants to do this from a library terminal, keeping the files on CD. That sounds like a really bad way to even start.  
[/QUOTE]  
In my case it’s the only way to start. I don’t have my own computer (well until the parts come in for a Judge Dredd and I swap a pinball overhaul for a laptop.)

Thanks to everyone for the help. It’ll take some time but I plan to try editing the .htaccess file to do what I want. It’ll take take time because I only have an hour a day I can use the library computer.

---

<div class="post-metadata">

### Author: ![Terminus\_Est](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/terminus_est/32/3087_2.png) [@Terminus\_Est](https://boards.straightdope.com/u/Terminus_Est)
#### Post date: [December 7, 2007, 5:05pm UTC](https://boards.straightdope.com/t/directory-tree-html/428956/20 "2007-12-07T17:05:53Z")

</div>

Wait a minute, these files are still on CD? The first step is to actually put them on the server.

[Next page](https://boards.straightdope.com/t/directory-tree-html/428956.md?page=2)
