PDA

View Full Version : Directory Tree --> HTML


Will Repair
12-05-2007, 03:47 PM
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 but it won't allow the use of long filenames and the admin has disabled 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?

dmatsch
12-05-2007, 03:59 PM
re-read your post. Since cmd is disabled, you cant do this:

dir *.* > output.htm

Will Repair
12-05-2007, 04:06 PM
dir *.* > output.htmAccess 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.

Terminus Est
12-05-2007, 04:16 PM
Didn't you get my PM?

MrSquishy
12-05-2007, 04:18 PM
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 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?

Terminus Est
12-05-2007, 04:25 PM
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.

MrSquishy
12-05-2007, 04:26 PM
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.

Will Repair
12-05-2007, 04:53 PM
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 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.

ZipperJJ
12-05-2007, 06:57 PM
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?

Punoqllads
12-05-2007, 07:17 PM
Httpd has a hierarchical permissions system layered on top of the Unix filesystem. Merely changing directory permissions would not be sufficient.

Terminus Est
12-05-2007, 07:19 PM
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.

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 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.


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.

Punoqllads
12-05-2007, 07:27 PM
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.Both ftp and sftp allow the user to change file permissions if they are connected as the owner of that file.

Terminus Est
12-06-2007, 02:11 PM
Both ftp and sftp allow the user to change file permissions if they are connected as the owner of that file.
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.

ZipperJJ
12-06-2007, 02:27 PM
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.

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.

MrSquishy
12-06-2007, 05:22 PM
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):
Options +Indexes
Described here (http://httpd.apache.org/docs/2.0/mod/core.html#options), "+Indexes" will enable indexes:
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.
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.

GuanoLad
12-06-2007, 05:40 PM
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.

Terminus Est
12-06-2007, 05:55 PM
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.
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.

GuanoLad
12-07-2007, 06:00 AM
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.

Will Repair
12-07-2007, 10:01 AM
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.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.

Terminus Est
12-07-2007, 11:05 AM
Wait a minute, these files are still on CD? The first step is to actually put them on the server.

MrSquishy
12-07-2007, 12:10 PM
OK, hold on. Do you (Will) want other people to be able to download the actual files themselves, or just a listing of the file names? If all you want is people to be able to access a listing of the files, we have gone way off track.

MrSquishy
12-07-2007, 12:52 PM
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.OK, I just re-read this part, so I think we're on the same page. To summarize, again, assuming I'm understanding what it is you want to do, you should follow these steps:

1. Copy (upload) all the files from your CDs/DVD to the web server.
2. Add the "Options +Indexes" line to your .htaccess file.
3. There is no step 3.

You know, as another alternative, you might consider something like box.net (http://www.box.net). It's just a place where you can store files and let other people download them. It's pretty slick. It does cost money, but you can try it for 2 weeks for free.

Terminus Est
12-07-2007, 01:24 PM
Step 3 is "Profit!"