# File count in server directory? (javascript)



## The BOBS Fan (Nov 29, 2006)

I have a program that places a photo capture on the webserver every x minutes. Each successive capture has the same name, except for an increment (EX: photo-00010.jpg, photo-00011.jpg, etc). 

I wrote another program to read the files on the server. I would like it to be able to check to see a) how many files are in this directory, and b) the name (or number) of the last file uploaded, using javascript, if possible.

Suggestions, please?

Thanks in advance,

TBF


----------



## MMJ (Oct 15, 2006)

JavaScript has no file operations.


----------



## nj2b (Sep 9, 2006)

Posting a request to server side script via ajax would probably do. I've used ajax routines along with basic php on several projects with postive results. You could almost certainly post a request for the file count and/or last file uploaded and then use javascript to process the return text.


----------



## colinsp (Sep 5, 2007)

It shouldn't be difficult to do this in php. Don't forget some people have javascript turned off in their browsers and php will run even if they have disabled javascript.


----------



## MMJ (Oct 15, 2006)

colinsp said:


> It shouldn't be difficult to do this in php. Don't forget some people have javascript turned off in their browsers and php will run even if they have disabled javascript.


To clarify: because it runs on the server, not the client (browser).


----------



## colinsp (Sep 5, 2007)

You're right sorry I should have made that clearer.


----------

