package com.xcong.farmer.cms.common.utils;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.util.Enumeration;
|
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipFile;
|
|
/**
|
* @author wzy
|
* @date 2022-07-04
|
**/
|
public class FileUtils {
|
|
public static String path(String path) {
|
if (!path.endsWith("/")) {
|
return path + "/";
|
}
|
|
return path;
|
}
|
|
public static String path(String path, String fileName) {
|
File file = new File(path);
|
if (!file.isDirectory()){
|
return "";
|
}
|
|
String dir = path(path);
|
return dir + fileName;
|
}
|
|
public static void zipUpload(File file, String templateDir, String staticDir) throws IOException {
|
ZipFile zipFile = new ZipFile(file);
|
|
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
if (entries.hasMoreElements()) {
|
ZipEntry zipEntry = entries.nextElement();
|
if (zipEntry.isDirectory()) {
|
// zipEntry.
|
}
|
System.out.println(zipEntry.getName());
|
}
|
}
|
}
|