To get the list of all files in a directory import java.io.*
and then in a try/catch:

File directory = new File( "directoryPath" );
String[] listOfFilesInDirectory = directory.list();

Now you have a String array of all the files and directories within
the directory passed into the new File() constructor.



On 28 Aug 2001, at 13:18, sanjib B wrote:

> Hi All ,
> Please help !!
> I wanna do the following. Suppose on my directory/file structure I have the following
>
> dirA
>     \filea
>     \fileb
>     \filec
> dirB
>     \filed
>     \filee
>
> On my JSP pahe I wanna show two links first. One of dirA and another of dirB. If the 
>user clicks on A/B I wanna branch out that link and show all the files available 
>under that dirA.
>
> How do I do it ?? The content of the directories in my file structure is dynamically 
>changing. So the number of files and the name of the files can change dynamically.
>
> Wishing a good know how for my query
> Thanks
> sanjibb
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets



--

Any man, in the right situation, is capable of murder.
But not any man is capable of being a good camper. So, murder
and camping are not as similar as you might think.

           - Jack Handey

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to