scanning a directory using javascript

D

Dean

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
 
D

Dave Griffiths

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


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

Grant Wagner

Dean said:
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

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/WebLoadFile/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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* 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-developer/upgrade_2.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top