「Java」java.io.FilenameFilterクラスの使い方

Javaコード
import java.io.File;
import java.io.FilenameFilter;
public class FileDemoFileterDemo {
public static void main(String[] args){
File[] files =File.listRoots();
for(File file:files){
System.out.println(file);
if(file.length()>0){
String[] filenames =file.list(new FilenameFilter(){
//file–フォルダ name–ァイル名
public boolean accept(File file,String filename){
return filename.endsWith(“.csv");
}
});
for(String filename:filenames){
System.out.println(filename);
}
}
}
}

}

Java

Posted by arkgame