Can anyone help me and provide a way to list files in a directory using javascript. This is on the server (NOT CLIENT). For our purposes we have built a simple search facility (that all we need) and the code takes data from an array. All we want to do is traverse the HTML files, open each one and take out the key words to put into an array.

I have searched google to no avail. Some articles say this can be done but don't provide examples and some articles say it cannot be done. A cross browser simple example would be nice.

Help appreciated in advance

7 Years
Discussion Span
Last Post by ShawnCplus

Nope, you have to use a server-side language. Javascript lives in the browser so it can't directly touch either your server or your client's machine. You can have Javascript make a request to the server which provides a listing but Javascript itself can't.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.