package com.bawei.fan;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;
public class SaoMiao2 {
private static List<File> list;
public static void main(String[] args) {
File f=new File("E://范丽清//songs");
list = new ArrayList<File>();
getData(f);
for(File fs:list)
{
System.out.println(fs.getName());
}
}
private static void getData(File path) {
File[] ff=path.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
if(pathname.isDirectory())
{
return true;
}
else
{
String name = pathname.getName();
return (name.endsWith(".mp3"));
}
}
});
if(ff!=null)
{
for(File f1:ff)
{
if(f1.isFile())
{
list.add(f1);
}
else
{
getData(f1);
}
}
}
}
}