public class FilsList {
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
File baseFile = new File("E:\\study_ideaWorkspace\\DataMigration\\src\\main\\java\\com\\primeton\\datamigration\\pojo2");
if (baseFile.isFile() || !baseFile.exists()) {
System.out.println( list);
}
File[] files = baseFile.listFiles();
for (File file : files) {
list.add(file.getName());
}
System.out.println( list);
}
}
获取文件夹下的文件名称
最新推荐文章于 2024-08-24 22:01:16 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)