func FileCopy(src, dst string) bool {
    pwd, _ := os.Getwd()
    osPart := "/"
    if runtime.GOOS == "windows" {
        osPart = "\\"
    }
    src = pwd + osPart + src

    byteSlice, err := ioutil.ReadFile(src)
    if err != nil {
        log.Println(err)
        return false
    }
    WriteWithIoutilByte(dst, byteSlice)
    return true
}
func WriteWithIoutilByte(name string, content []byte) {
    if ioutil.WriteFile(name, content, 0644) == nil {
        log.Println("写入文件成功", name)
    }
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code