标签:存在 import 目录 scan ext code rate ret java
package com.test;
import java.io.File;
import java.util.Scanner;
import com.DIGUI;
public class test_4 {
public static void main(String[] args) {
// TODO Auto-generated method stub
File dir =getDir();
deleteFile(dir);
}
public static void deleteFile(File dir) {
File[] subFiles =dir.listFiles();
for (File subFile : subFiles) {
if(subFile.isFile()) {
subFile.delete();
}else {
deleteFile(subFile);
}
}
dir.delete();
}
public static File getDir() {
Scanner sc =new Scanner(System.in);
while(true) {
String line = sc.nextLine();
File dir =new File(line);
if(!dir.exists()) {
System.out.println("路基不存在");
}else if(dir.isFile()) {
System.out.println("是文件");
}else {
return dir;
}
}
}
}
标签:存在 import 目录 scan ext code rate ret java
原文地址:https://www.cnblogs.com/cloudLi/p/13072166.html