#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Norway
    Posts
    12
    Rep Power
    0

    Question CGI: listing pwd with remote script - possible?


    Hello!

    I don't know if this is the right place to post this message, but why not try people:D .

    My problem is this; I want to list the contents of the directory I'm currently in(PWD), with a script that is placed in the cgi-bin folder.

    Example:

    I'm in directory-x, directory-x contains a htaccess file that makes /cgi-bin/script.cgi the indexfile( DirectoryIndex /cgibin/script.cgi ). My goal is to make script.cgi list the contents of the PWD(in this case: directory-x), and not the cgi-bin.

    Can someone please give me some pointers, some sample code? Or the whole script if it isn't to big of a problem? Anything. I'm as green as a programmer can be(if I can be called that at all).

    (If my description of the problem was too short, please say so. I REALLY need help with this)

    Thanks
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,091
    Rep Power
    2222
    Actually, the Linux section should be more appropriate for shell programming questions.

    Just off the top of my head, I would think setting an environment variable to the output of pwd and then using it; eg:
    Code:
    CURR_DIR=`pwd`
    ls $CURR_DIR
    OK, you fooled me! It doesn't matter where that script is, because the ls command will always list the current directory if you don't specify one.

    However, you also dropped a hint that there's more going on here than you told us. Your reference to /cgi-bin tells us that you're doing working with CGI. I think we also have a Apache section here that might be the appropriate place to post your question.

IMN logo majestic logo threadwatch logo seochat tools logo