package test;
import java.io.File;
import java.io.FileFilter;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
String path = "C:\\";
File dir = new File(path);
if (dir.exists() && dir.isDirectory()) {
File fv[] = dir.listFiles(new FileFilter() {
public boolean accept(File f) {
return f.isFile();
}
});
for (File f : fv) {
System.out.println(f.getName());
}
}
}
private static String[] listFiles(String productID) {
String path = "C:\\";
File dir = new File(path);
if (dir.exists() && dir.isDirectory()) {
File fv[] = dir.listFiles(new FileFilter() {
public boolean accept(File f) {
return f.isFile();
}
});
String fileNames[] = new String[fv.length];
for (int i = 0; i < fv.length; i++) {
fileNames[i] = fv[i].getName();
}
return fileNames;
}
return new String[0];
}
}