public class Test2 { public static void main(String[] args) {
new Test2("e:\\temp");
}
class Filter implements FilenameFilter
{
public boolean accept(File dir, String name)
{
if (new File(dir,name).isDirectory())
return true;
if (name.endsWith("xml"))
return true;
return false;
}
}
public Test2(String dir)
{
check(dir);
}
public void check(String dir)
{
File f = new File(dir);
Filter fl = new Filter();
File[] farray;
farray = f.listFiles(fl);
for (int i = 0; i<farray.length; i++)
{
if (farray[i].isDirectory())
check(farray[i].getAbsolutePath());
else System.out.println(farray[i].getAbsolutePath());
}
}
}
new Test2("e:\\temp");
}
class Filter implements FilenameFilter
{
public boolean accept(File dir, String name)
{
if (new File(dir,name).isDirectory())
return true;
if (name.endsWith("xml"))
return true;
return false;
}
}
public Test2(String dir)
{
check(dir);
}
public void check(String dir)
{
File f = new File(dir);
Filter fl = new Filter();
File[] farray;
farray = f.listFiles(fl);
for (int i = 0; i<farray.length; i++)
{
if (farray[i].isDirectory())
check(farray[i].getAbsolutePath());
else System.out.println(farray[i].getAbsolutePath());
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货