6

I have folder in which there are no. of html files. Can i count the no. of files using javascript? Please help

Thanks

2 Answers 2

3

No, this is not possible using JavaScript only.

You can make an Ajax call to a page and from the server side code you can find the number of files in a folder and then return the result to the callback function.

I assume the files are in not in the client machine.

Sign up to request clarification or add additional context in comments.

Comments

3

Javascript is a client side language. This means that it has no interaction at all with the server. It get sends unprocessed by the server to the client and the client executes it.

However, what you could do is learn AJAX - if you don't know it yet - and create a script (PHP, ASP, Perl, SSI, etc.) that counts the files in the directory and prints the number - I recommend Perl - .
Each minute, for example, the AJAX page would fetch the response of the script and display it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.