Commit bb791662 authored by 张永's avatar 张永

add 删除指定后缀文件

parent 637e5fec
...@@ -378,6 +378,16 @@ public class FileUtil { ...@@ -378,6 +378,16 @@ public class FileUtil {
} }
} }
public static void fileDeleteBySuffix(String filePath,String suffix) {
File file = new File(filePath);
File[] files = file.listFiles();
for(File f:files) {
if(f.getName().endsWith(suffix)) {
f.delete();
}
}
}
public static byte[] streamToBytes(InputStream instream) { public static byte[] streamToBytes(InputStream instream) {
byte[] bytes = null; byte[] bytes = null;
ByteArrayOutputStream baos = null; ByteArrayOutputStream baos = null;
......
...@@ -138,9 +138,10 @@ public final class ZipUtil { ...@@ -138,9 +138,10 @@ public final class ZipUtil {
} }
public static void main(String[] args) { public static void main(String[] args) {
String targetPath = "D:\\Green\\IDC\\50010"; String targetPath = "D:\\data\\erp\\91310114594794273Y";
File file = ZipUtil.zip(targetPath); File file = ZipUtil.zip(targetPath);
ZipUtil.unzip(file, "D:\\IDC"); System.out.println(file.getName());
//ZipUtil.unzip(file, "D:\\data\\erp\\91310114594794273Y");
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment