Browse Source

增加日志控制

master
Viviman 2 years ago
parent
commit
3d3f60932a
  1. 6
      golang_learn/data_func/go_to_dir/readDir/Linux执行命令.log
  2. 5
      golang_learn/data_func/go_to_dir/readDir/Windows执行命令.log
  3. 11
      golang_learn/data_func/go_to_dir/readDir/linux读取指定目录下文件夹,文件向上移动两层.go
  4. 7
      golang_learn/data_func/go_to_dir/readDir/windows读取指定目录下文件夹,文件向上移动两层.go

6
golang_learn/data_func/go_to_dir/readDir/Linux执行命令.log

File diff suppressed because one or more lines are too long

5
golang_learn/data_func/go_to_dir/readDir/Windows执行命令.log

File diff suppressed because one or more lines are too long

11
golang_learn/data_func/go_to_dir/readDir/linux读取指定目录下文件夹,文件向上移动两层.go

@ -10,6 +10,11 @@ func main() {
a, _ := filepath.Abs("./")
fmt.Printf("当前目录:%s\n", a)
del := "rm -rf ./unzip"
fmt.Printf("执行命令:%s\n", del)
cmd := exec.Command(del)
_ = cmd.Run()
// 执行解压操作,固定死目录和文件名称
// drc:drc jth:jth 同目录下存在 unzip 目录(用于解压文件)
shellUnzip := fmt.Sprintf("cd %s && "+
@ -18,10 +23,12 @@ func main() {
"export Hy7zLogFileName=%s/hy_7z.log && "+
"/opt/apps/cn.com.epsoft.qggwy/files/qggwy/jdk/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)
cmd := exec.Command(shellUnzip)
fmt.Printf("执行命令:%s\n", shellUnzip)
cmd = exec.Command(shellUnzip)
_ = cmd.Run()
mvPhotos, all := fmt.Sprintf("cd %s/unzip/Photos", a), ""
fmt.Printf("执行命令:%s\n", mvPhotos)
cmd = exec.Command(mvPhotos)
_ = cmd.Run()
for _, i := range f {
@ -31,11 +38,13 @@ func main() {
all += fmt.Sprintf("cd %s/ && mv * ../ && ", i)
}
all += "ls"
fmt.Printf("执行命令:%s\n", all)
cmd = exec.Command(all)
_ = cmd.Run()
// 生成压缩包
zipFile := fmt.Sprintf("7z a 1.zip %s/unzip/", a)
fmt.Printf("执行命令:%s\n", zipFile)
cmd = exec.Command(zipFile)
_ = cmd.Run()
}

7
golang_learn/data_func/go_to_dir/readDir/windows读取指定目录下文件夹,文件向上移动两层.go

@ -12,7 +12,9 @@ func main() {
a = "E:/"
cmd := exec.Command("del /S/Q unzip\\*.*")
del := "del /S/Q unzip\\*.*"
fmt.Printf("执行命令:%s\n", del)
cmd := exec.Command(del)
_ = cmd.Run()
// 执行解压操作,固定死目录和文件名称
@ -23,6 +25,7 @@ func main() {
"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()
@ -33,11 +36,13 @@ func main() {
}
}
all += "ls"
fmt.Printf("执行命令:%s\n", all)
cmd = exec.Command(all)
_ = cmd.Run()
// 生成压缩包
zipFile := fmt.Sprintf("7z a 1.zip %s/unzip/", a)
fmt.Printf("执行命令:%s\n", zipFile)
cmd = exec.Command(zipFile)
_ = cmd.Run()
}

Loading…
Cancel
Save