|
Java Source Codes
Finding Directories
import java.io.*;
public class FindDirectories
{ public static void main(String[] args)
{ if (args.length == 0) args = new String[] { ".." };
try
{ File pathName = new File(args[0]);
String[] fileNames = pathName.list();
for (int i = 0; i<fileNames.length; i++)
{ File tf = new File(pathName.getPath(),
fileNames[i]);
if (tf.isDirectory())
{ System.out.println(tf.getCanonicalPath());
main(new String [] { tf.getPath() });
}
}
}
catch(IOException e)
{ System.out.println("Error: " + e);
}
}
}
<<<----- Return to
Java Source
Code Questions Page.
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Java Interview
Questions for more Java Interview Questions with answers
Check
Servlet Interview
Questions for more Servlet Interview Questions with answers
Check
Structs Interview
Questions for more Structs Interview Questions with answers
|