Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how i get all directory or file in determined drive?

8 views
Skip to first unread message

smeer_alwosabi

unread,
Sep 16, 2004, 2:57:51 AM9/16/04
to
This class contains recursive method which print all directory or
files in determined directory
Class print{
Print () { }
Void printDirectoryOrFile(String path)
{
String a[]=new File(path).list();
For(int i=0;i<a.length;i++)
{ File b=new File(path+"\\"+a[i]);
If (b.isDirectory())
{
System.out.println(path+"\\"+a[i]);
printDirectoryOrFile(path+"\\"+a[i]); //recursive method

}
else
System.out.println(path+"\\"+a[i]);
}
}
Static void main ()
{
Print print=new Print()
Print. printDirectoryOrFile("c:\\smeer");
}
}

But how i get all directory or files in determined drive, perhaps
there are classes
Which support that,so i wish to help me.

0 new messages