|
|
|
@ -3,7 +3,6 @@ package FileUtil
|
|
|
|
|
import (
|
|
|
|
|
"bufio"
|
|
|
|
|
"fmt"
|
|
|
|
|
"io"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -58,21 +57,3 @@ func WriteLines(lines []string, path string) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func CopyFile (dstFilePath string,srcFilePath string)(written int64, err error){
|
|
|
|
|
srcFile,err := os.Open(srcFilePath)
|
|
|
|
|
if err != nil{
|
|
|
|
|
fmt.Printf("打开源文件错误,错误信息=%v\n",err)
|
|
|
|
|
}
|
|
|
|
|
defer srcFile.Close()
|
|
|
|
|
reader := bufio.NewReader(srcFile)
|
|
|
|
|
|
|
|
|
|
dstFile,err := os.OpenFile(dstFilePath,os.O_WRONLY | os.O_CREATE,0777)
|
|
|
|
|
if err != nil{
|
|
|
|
|
fmt.Printf("打开目标文件错误,错误信息=%v\n",err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
writer := bufio.NewWriter(dstFile)
|
|
|
|
|
defer dstFile.Close()
|
|
|
|
|
return io.Copy(writer,reader)
|
|
|
|
|
}
|