Java File System: How to search for files in a directory and subdirectories?
Q: How to search for files in a directory and subdirectories?
A: The following small program when executed like this:
should print a list of files in the current directory
// sample from Absolute Java FAQ
public class FileList
public static void main(String args)
for (int i = 0;i < args.length; i++)
System.out.println("File " + i + ":" + args[i]);