|
|
@ -2,49 +2,55 @@ package main |
|
|
|
|
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"os" |
|
|
|
"os/exec" |
|
|
|
"path" |
|
|
|
"path/filepath" |
|
|
|
) |
|
|
|
|
|
|
|
func main() { |
|
|
|
a, _ := filepath.Abs("./") |
|
|
|
fmt.Printf("当前目录:%s\n", a) |
|
|
|
fmt.Printf("当前目录:%s \n开始执行...\n", a) |
|
|
|
|
|
|
|
a = "E:/" |
|
|
|
|
|
|
|
del := "del /S/Q unzip\\*.*" |
|
|
|
fmt.Printf("执行命令:%s\n", del) |
|
|
|
cmd := exec.Command(del) |
|
|
|
_ = cmd.Run() |
|
|
|
// 删除目录
|
|
|
|
winError(os.RemoveAll(path.Join([]string{a, "unzip"}...))) |
|
|
|
|
|
|
|
// 新建目录
|
|
|
|
winError(os.Mkdir(a+"/unzip", os.ModePerm)) |
|
|
|
winError(os.Mkdir(a+"/unzip/Photos", os.ModePerm)) |
|
|
|
winError(os.Mkdir(a+"/unzip/Table", os.ModePerm)) |
|
|
|
|
|
|
|
// 执行解压操作,固定死目录和文件名称
|
|
|
|
// drc:drc jth:jth 同目录下存在 unzip 目录(用于解压文件)
|
|
|
|
shellUnzip := fmt.Sprintf("cd %s && "+ |
|
|
|
"set Hy7zEncryptPath=%s/drc.drc && "+ |
|
|
|
"set Hy7zJarPath=%s/jth.jth && "+ |
|
|
|
"set Hy7zLogFileName=%s/hy_7z.log && "+ |
|
|
|
"D:\\hzb2022\\tomcat8\\JDK1.8\\jre\\bin\\java -jar -Xms512m -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=512M "+ |
|
|
|
"%s/jth.jth unzip %s/1.hzb %s/unzip %s/unzip/Photos Z93z4H5b6z7d35b8", a, a, a, a, a, a, a, a) |
|
|
|
fmt.Printf("执行命令:%s\n", shellUnzip) |
|
|
|
cmd = exec.Command(shellUnzip) |
|
|
|
_ = cmd.Run() |
|
|
|
|
|
|
|
mvPhotos, all := fmt.Sprintf("%s/unzip/Photos", a), "" |
|
|
|
winError(exec.Command("cd " + a).Start()) |
|
|
|
winError(exec.Command("set Hy7zEncryptPath=" + a + "/drc.drc").Start()) |
|
|
|
winError(exec.Command("set Hy7zJarPath=" + a + "/jth.jth").Start()) |
|
|
|
winError(exec.Command("set Hy7zLogFileName=" + a + "/hy_7z.log").Start()) |
|
|
|
winError(exec.Command(a + "/jre/bin/java -jar -Xms512m -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=512M " + |
|
|
|
a + "/jth.jth unzip " + a + "/1.hzb " + a + "/unzip " + a + "/unzip/Photos Z93z4H5b6z7d35b8").Start()) |
|
|
|
|
|
|
|
for _, i := range e { |
|
|
|
for _, i2 := range e { |
|
|
|
all += fmt.Sprintf("move %s/%s/%s/*.* %s && ", mvPhotos, i, i2, mvPhotos) |
|
|
|
winError(exec.Command("cd " + a + "/unzip/Photos/" + i + "/" + i2 + " && move *.* ../../").Start()) |
|
|
|
fmt.Printf("%s \n", "cd "+a+"/unzip/Photos/"+i+"/"+i2+" && move *.* ../../") |
|
|
|
winError(exec.Command("rd /s /q " + a + "/unzip/Photos/" + i + "/" + i2 + "/").Start()) |
|
|
|
fmt.Printf("%s \n", "rd /s /q "+a+"/unzip/Photos/"+i+"/"+i2+"/") |
|
|
|
} |
|
|
|
} |
|
|
|
all += "ls" |
|
|
|
fmt.Printf("执行命令:%s\n", all) |
|
|
|
cmd = exec.Command(all) |
|
|
|
_ = cmd.Run() |
|
|
|
winError(exec.Command("del " + a + "/unzip/zipfilelist.properties").Start()) |
|
|
|
fmt.Printf("%s \n", "del "+a+"/unzip/zipfilelist.properties") |
|
|
|
|
|
|
|
// 生成压缩包
|
|
|
|
zipFile := fmt.Sprintf("7z a 1.zip %s/unzip/", a) |
|
|
|
fmt.Printf("执行命令:%s\n", zipFile) |
|
|
|
cmd = exec.Command(zipFile) |
|
|
|
_ = cmd.Run() |
|
|
|
winError(exec.Command("7z a 1.zip " + a + "/unzip/").Start()) |
|
|
|
fmt.Printf("%s \n", "7z a 1.zip "+a+"/unzip/") |
|
|
|
} |
|
|
|
|
|
|
|
var e = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"} |
|
|
|
|
|
|
|
func winError(e error) { |
|
|
|
if e != nil { |
|
|
|
// fmt.Println(e)
|
|
|
|
} |
|
|
|
} |
|
|
|