• Post Reply Bookmark Topic Watch Topic
  • New Topic

determine if files exsist and how many are there

 
mark babcock
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need some help. Here is the scenario. I have a web server running and everytime someone fills out a form it places a new text file in a specific directory. I need to write a Java application that will determine how many of these files there are. I know that I need to use the java.io package and that File class will be helpful. I'm just a bit stuck getting this going. Is anyone able to assist? Thanks.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a File object representing the directory you're putting stuff in. (Yes, the confusingly-named File class can represent a directory or a file.) The File can then be queried to see what other files are in the directory:

See the API for File to find out other methods you can use to get more info on the file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!