Documentation
¶
Overview ¶
Package dlinux
用于操作linux的函数集合
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
func Copy: 拷贝文件
src: 源文件
dst: 目的文件
BUFFERSIZE: 缓存大小
Example ¶
src := "/root/1.txt"
dst := "/root/2.txt"
var buf int64 = 128
err := Copy(src, dst, buf)
if err != nil {
log.Fatalln(err)
}
Output: some io.Reader stream to be read
func PathExists ¶
PathExists :golang判断文件或文件夹是否存在的方法为使用os.Stat()函数返回的错误值进行判断:
返回值:
true,nil: 如果返回的错误为nil,说明文件或文件夹存在 false,nil:说明文件或文件夹不存在 false,err: 如果返回的错误为其它类型,则不确定是否在存在
Example ¶
exists, err := PathExists("/root/dingyz/xxx")
if err != nil {
fmt.Printf("文件不确定是否存在,有报错:%s", err.Error())
return
}
if exists {
fmt.Println("文件存在")
} else {
fmt.Println("文件不存在")
}
Output: 文件存在
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.