private static List<String> list = new ArrayList<String>(); public static void main(String[] args){ FileOperate iFile = new FileOperate(); File file = new File("E:\\"); iFile.findFile(file); } public void findFile(File file){ File[] files = file.listFiles(); if (files == null){ return; }else{ for (int i = 0; i < files.length; i++){ if (files[i].isDirectory()){ System.out.println("正在扫描"+files[i].getAbsolutePath()); findFile(files[i].getAbsoluteFile()); }else{ if(files[i].getName().endsWith("avi")){ list.add(files[i].getAbsolutePath()); } } } } }