- public class moveFile {
-
- private static String oldPath = null;
-
- public static void main(String[] args) {
- oldPath = "D:\\Download";
- findFile(oldPath);
- }
-
- public static void findFile(String path) {
- File f = new File(path);
- File[] fileNames = f.listFiles();
-
- for (File child : fileNames) {
- if (child.getName().matches("^a"))
- System.out.println(child.getName());
- }
- }
- }
复制代码 文件夹下面有以“a” 开头的文件 为什么不输出呢 |