Use file name filters when listing files. The example below lists all mp3 files in the given root directory (Note. The code below is not recursive for all folders under root ) -
String files[] = root.list(audioFilter); FilenameFilter audioFilter = new FilenameFilter() { File f; public boolean accept(File dir, String name) { if(name.endsWith(".mp3") || name.endsWith(".MP3")) { return true; } f = new File(dir.getAbsolutePath()+"/"+name); return f.isDirectory(); } };
bluefalcon
source share