This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have a servlet which is supposed to go into a certain directory called year which has a subdirectory dayOfYear. The dayOfyear directory has data files which are named from the first day of the year to 365 or 366 depending on if it is a leap year. This servlet is supposed to get all the years from the year directory and get all the dayOfYears from the dayOfYear directory and print out a certain year and all of its days. How would I be able to access these directories and files, manipulate there names as strings, and output a year and all of its days as a string.
JeanLouis Marechaux
Ranch Hand
Joined: Nov 12, 2001
Posts: 906
posted
0
You can manage directories using the java.io.File package. Basically f = new File(path); File[] ls = f.listFiles(); Give you the list of the directories or files you have within the specified path. ls[i].isDirectory(), well, it's quite obvious, tell you if it is a directory or a file.. and f.getName() give you the name Take a look at java.io.File for further information HTH
/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community