Commit 77566e3d authored by ligaishun's avatar ligaishun

Update process.go

parent 5d4e2431
......@@ -407,4 +407,33 @@ func Preprocessing(){//判断密钥对是否存在,存在则删除
err=os.RemoveAll("/root/.ssh")
tlog.Info(err.Error())
}
}
\ No newline at end of file
}
func cp(src,dst string,){//复制文件并赋予执行权限
cp:=exec.Command("cp","-rf",src,dst)
fmt.Println(cp.String())
fmt.Println(os.Chmod(src,0755))
fmt.Println(cp.Run())
}
func MVScripts(src,dst string){//Absolute Path
path,err:=os.Getwd()
err=os.Chdir(src)
if err!=nil{
tlog.Info("invalid directory")
}
dir,_:=ioutil.ReadDir("./")
for _,f:=range dir{
if f.IsDir()&&f.Name()=="scripts"{
dir2,_:=ioutil.ReadDir(f.Name()+"/")
os.Chdir(f.Name())
for _,s:=range dir2{
if s.Name()==".gitkeep"{
continue
}
cp(s.Name(),path+"/"+f.Name()+"/"+s.Name())
}
}
}
os.Chdir(path)
}
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