public static boolean ifFilesInDir(String dir,String fileName){
File file = new File(dir);
boolean rs = false;
List<String> files =new ArrayList<String>();
File[] tempList = file.listFiles();
for(int i =0;i<tempList.length;i++){
if (tempList[i].isFile()) {
String name = tempList[i].getAbsolutePath();
String name2 = tempList[i].getName();
System.out.println(name2);
String a = name.split("\\\\")[2];
files.add(a);
}
}
for(String name:files){
if(name.contains(fileName)){
rs = true;
}
}
return rs;
}
public static void delectFiles(String dir){
File file = new File(dir);
if(file.isDirectory()){
String[] children = file.list();
for (int i=0; i<children.length; i++) {
//System.out.println(children[i]);
try {
new File(file,children[i]).delete();
} catch (Exception e) {
System.out.println(e);
}
}
}
}