By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

scanning a directory using javascript

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.