468,769 Members | 2,272 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,769 developers. It's quick & easy.

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
Jul 20 '05 #1
2 17171
On Thu, 11 Sep 2003 07:04:57 -0700, Dean wrote:
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.
Jul 20 '05 #2
Dean wrote:
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/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 <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_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-deve...upgrade_2.html
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Nazgob | last post: by
10 posts views Thread by Alan Searle | last post: by
2 posts views Thread by Alan Searle | last post: by
4 posts views Thread by tshad | last post: by
23 posts views Thread by Rotsey | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.