import java.io.File;
public class File_Demo {
public static void main(String[] args) {
File f = new File("E:/JAVAEE学习文件");
printFile(f);
}
private static void printFile(File f) {
File[] sss = f.listFiles();
for (File file : sss) {
if(file.isFile()){
System.out.println("文件:"+file.getAbsolutePath());
}
if(file.isDirectory()){
System.out.println("文件夹:"+file.getAbsolutePath());
printFile(file);
}
}
}
}
|
|