scanning a directory using javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dean

    scanning a directory using javascript

    Hi

    I've got a question relating to using Javascript on an Intranet. I
    have a directory with a list of files in the format week36.xls,
    week37.xls
    and I want to write a script that will scan all the files in the
    directory and select the one with the highest week number then display
    in the browser window. A brief search hasn't revealed any code to do
    this so I just want to know if it is possible and what the function
    names are that would be involved.

    Cheers

    Dean
  • Dave Griffiths

    #2
    Re: scanning a directory using javascript

    On Thu, 11 Sep 2003 07:04:57 -0700, Dean wrote:
    [color=blue]
    > Hi
    >
    > I've got a question relating to using Javascript on an Intranet. I
    > have a directory with a list of files in the format week36.xls,
    > week37.xls
    > and I want to write a script that will scan all the files in the
    > directory and select the one with the highest week number then display
    > in the browser window. A brief search hasn't revealed any code to do
    > this so I just want to know if it is possible and what the function
    > names are that would be involved.
    >
    > Cheers
    >
    > Dean[/color]


    Just learning JS, but my book tells me that without the use of
    Certificates JavaScript cannot read or write files on the client computer,
    the book is fairly old, but this is all to do with t5he secrity issue, if
    you are on an intranet then the security issues should not be so
    important.

    I would be interested to know if this has changed, or what is required to
    do so.

    Comment

    • Grant Wagner

      #3
      Re: scanning a directory using javascript

      Dean wrote:
      [color=blue]
      > Hi
      >
      > I've got a question relating to using Javascript on an Intranet. I
      > have a directory with a list of files in the format week36.xls,
      > week37.xls
      > and I want to write a script that will scan all the files in the
      > directory and select the one with the highest week number then display
      > in the browser window. A brief search hasn't revealed any code to do
      > this so I just want to know if it is possible and what the function
      > names are that would be involved.
      >
      > Cheers
      >
      > Dean[/color]

      Client-side JavaScript, by itself, in the default security environment has
      no access to the names of files in a directory on a web server. Without
      some help from the server, client-side JavaScript by itself is unable to
      retrieve a "directory listing". With the server's help (by simply listing
      the contents of a directory when you request
      http://yourserver/yourexcelfiles/, or by returning a page that lists the
      contents of the directory) client-side JavaScript might have a chance of
      loading that directory listing into a hidden iframe and parsing the
      results. Of course, if you have server-side technology at your disposal to
      generate such a list, then you could simply use that server-side
      technology to choose the file with the newest date and display a link to
      it, no client-side JavaScript would be required at all.

      If you need to rely on a purely client-side solution, then you might be
      able to make use of the Java applet available at:
      <url: http://www.galasoft-lb.ch/myjava/Web...Demo/Demo.html />

      But honestly, choosing a file from a directory on the server with specific
      attributes and returning it to the browser is better suited to server-side
      processing.

      --
      | Grant Wagner <gwagner@agrico reunited.com>

      * Client-side Javascript and Netscape 4 DOM Reference available at:
      *


      * Internet Explorer DOM Reference available at:
      *
      Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


      * Netscape 6/7 DOM Reference available at:
      * http://www.mozilla.org/docs/dom/domref/
      * Tips for upgrading JavaScript for Netscape 7 / Mozilla
      * http://www.mozilla.org/docs/web-deve...upgrade_2.html


      Comment

      Working...