Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Perl Script For Listing Files

    I'm in the midst of what could turn out to be a long (Google) search for an available Perl script. My domain is hosted by a company which has my account on a Windows 2000 server. I would like to create a "public" directory on my site which, when accessed by any user, would list ALL the files in that directory. They could be graphics, text, zip files, etc. I just want a visitor to be presented with an "FTP-like" list so he/she could view or download from this directory. I don't know anything about programming, but the host company tells me you can't do it on Win2000 with permissions, you have to use a (xxxxx.pl) script.

    While I'm searching (and there's LOTS of places to look at!) does anyone have a suggestion for such a script? I'm not afraid to do modifications to change the directory name, or like that. Thanks for thinking 'bout me!

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Perl Script For Listing Files

    Hi Al,

    I'm not really into Perl, but I believe this can easily be done with an ASP page. This will work on your host since it is Windows 2000.

    I'm headed out the door for a meeting now, but I'll try to get something together for you later today - if you don't find a solution before then.

    My idea is to use the FileSystemObject scripting component to make a list of files in the directory.

    Until then....

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    Cincinnati, Ohio, USA
    Posts
    7,089
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Perl Script For Listing Files

    Mark, correct me if I'm wrong, but if the host company doesn't have the ASP extension enabled or allowed, won't that cause problems? I know that my hosting company requires an email at the very least to enable additional file extensions (might be worth having done anyway, Al).
    -Mark

  4. #4
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Perl Script For Listing Files

    Thanx for the tip. I'll check their pages and/or send them a note asking about ASP.

  5. #5
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Perl Script For Listing Files

    Thanks to BOTH Marks for replying and asking. Looks like I'm OK..... but I'm going to ask them if it has to be "enabled" for my account.
    Attached Images Attached Images

  6. #6
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Coppell, Texas, USA
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Perl Script For Listing Files

    If they're hosting you on IIS, it may be very simple - depending on whether or not they allow you any control over the configuration of your web and/or virtual directories. IIS allows directory browsing (which is what you're doing when you get a list of files from a directory in FTP like fashion), but not by default. It needs to be turned on. If you can get this turned on for the directory you want to make public, you're all set with no coding. If they won't do that, you'll need to use script as suggested in the previous responses.

    HTH

  7. #7
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Perl Script For Listing Files

    Yeah Charlie, thanks but they (host) evidently don't want to be "bothered." It's a low-price, low-SUPPORT kinda deal. It was they who told me I would need to use a Perl script to do the job. I've spent considerable time this afternoon searching and so far haven't come up with anything. I've found a number of scripts that allow one to do file management on your domain from a browser but that's TOO MUCH. I don't want visitors uploading or deleting files. I'll keep a-huntun'

  8. #8
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Coppell, Texas, USA
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Perl Script For Listing Files

    Typical response from a web host, but you have to try. If you can get them to allow ASP (active server pages) in your web, then it's not hard. I prefer JavaScript to VBScript, and found it's not hard at all to list folders and files. I co-wrote an article with a colleague about using just such a script to display a music catalog (MP3s) using just the native objects available in ASP. I've attached some of the code from those web pages - specifically the functions that use the File System Object to list folders and files.

    Of course, most normal people use VBScript, not JavaScript on the server side. And this is probably more complicated than what you need. But I'm sure you can find code samples for this in VB if necessary. If not, let me know and I'll come up with one.

    HTH
    Attached Files Attached Files

  9. #9
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Perl Script For Listing Files

    A question for MarkJ: I've searched so much my eyes hurt! . <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

    BUT, I'd like to solicit your opinion on this link.

    Since I know nada about ASP or Perl, do you think this code will do the job I'm looking for? Sorry to impose on your time, but I'd really appreciate your opinion.

  10. #10
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Perl Script For Listing Files

    HI Al,

    I'm sorry for not being able to finish that code for you. I kept running into some problems on my local server when using the FileSystemObject. I believe that Norton Antivirus blocked the use of the Scripting object because it thought it was being used for malicious purposes (hardly!)...

    The link you posted does exactly what I was trying to do (except it looks better). That's definitely the way to go. I would probably add a few lines of code to exclude ASP and HTM(L) files just because your users don't realy need to download those. (See attachment) I also made a few tweaks to the way the current folder name is acquired. When running on my local webserver, this made the difference between working and not working.

    Great searching - you've definitely found a winner!

    Note: As I try to use the sample on my web host, it will not display. I'll have to check the settings to see if any necessary permissions are disabled for some reason. I was finally able to run the code on my local computer with a few modifications.

    Hope this helps!

    Update: I got the file working on my server after tinkering with the permissions (using my web host's web-based control panel). I assigned full control to the System user which did the trick. Yipee! <img src=/S/joy.gif border=0 alt=joy width=23 height=23>
    Attached Files Attached Files

  11. #11
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Perl Script For Listing Files

    Hallelul-Ya! What a wonderment you are, MR. Mark!

    I uploaded the showfilelist.asp into the folder on my server and it works EXACTLY as you described! THANK YOU so much for the boost.

    As I asked in my PM I sent you, how does one get an ASP file to execute automatically, without having to have the user include it in the URL they enter? Should I make up an INDEX.HTML with an "onload" command, or what?

    See what THE LOUNGE has wrought! In the name of MarkJ, that is. Thanks again!

  12. #12
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Perl Script For Listing Files

    Hi Al,

    I'm glad to hear that it worked!

    As for getting the file to execute automatically, I would suggest renaming it to default.asp rather than trying to do an onLoad with another file.

    (Keep in mind that the Microsoft world treats default.htm/asp as the default page rather than index.html - that's the Unix/Netscape default.)

    One more thing... As for getting the icon images to show, be sure to download the image files from the ASP101 sample page. I had to do it manually because I never found a zipped sourcefile with all of the source and images included. After saving the images, upload them to a folder called images - created as a root-level folder.

    Let me know if you have problems with this. There is a place in the code that we can adjust to show a fixed images folder if necessary.

    HTH

  13. #13
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Perl Script For Listing Files

    Default.asp it shall be. See there, that's one mo' thing I just learned from ya! I didn't know about what the "default" conventions were.

    I hope I got back to my web page fast enough. I had accidently placed a graphic up there that's in rather bad taste. I just now went back and deleted it. I guess I also need to do something about that first "Contents of" statement where it says nothing else. I didn't realize there were icons and such involved, so I never looked for them, but I'll go back and do what you did right after lunch. Thanks again, MY FRIEND! (Hope that's not taking too much liberty)

  14. #14
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Perl Script For Listing Files

    Hi Al,

    I completely forgot about the "Contents of " line... I changed a variable name and forgot to change the corresponding variable in that line.

    If you don't want to see the line at all, you can delete the line in the file that says: Contents of <%= strPath %>

    OR, if you want it to read accurately, you can change the variable "strPath" to "strFolder" (without the quotes). I changed strPath to strFolder earlier in the file and didn't realize it was used again.

    <hr>...taking too much liberty...<hr>
    Not at all! I'm always glad to help!

  15. #15
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Perl Script For Listing Files

    Looks like while you were looking, I was "hacking." (Sorry 'bout that) I use a program called Araxis Merge for file or folder comparison, so I ran the original I downloaded against your improved modification and discovered that STRPATH variable hanging out there by itself. I did as you suggested above and changed it to your STRFOLDER variable but it proved to be a little much. On my server, when you layout a full path, you get server path info that isn't necessary to show the "public." So, what I did was to just change it to a title and made it a tad larger. Hope you don't mind.

    What I did have trouble with was the path to the icons. I tried putting them in a path called IMAGES at two different levels on my site and couldn't get 'em to show up. Finally, in desperation I removed the period ( ./images ) in that line of code and it worked. What's the period supposed to signify? Is it like the old DOS .. command to go back one directory?

    Anyway, it's all working (I hope!) if you want to go take a peek at my visitors page. I'm greatly indebted to you, Mark for hangin' with me.....

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •