filetil

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsolutePath added in v0.10.1

func AbsolutePath(p string) (string, error)

func CopyDir added in v0.10.1

func CopyDir(source string, dest string) (err error)

拷贝目录

func CopyFile added in v0.10.1

func CopyFile(source string, dst string) (err error)

拷贝文件

func FileExists added in v0.10.1

func FileExists(name string) bool

FileExists reports whether the named file or directory exists.

func FormatBytes added in v0.10.1

func FormatBytes(size int64) string

func HasFileOfExt added in v0.10.1

func HasFileOfExt(path string, exts []string) bool

判断指定目录下是否存在指定后缀的文件

func ReadFileAndIgnoreUTF8BOM added in v0.10.1

func ReadFileAndIgnoreUTF8BOM(filename string) ([]byte, error)

忽略字符串中的BOM头

func RemoveDir added in v0.10.1

func RemoveDir(dir string) error

func Round added in v0.10.1

func Round(val float64, places int) float64

Types

type FileList

type FileList struct {
	IsDir   bool   //是否是目录
	Path    string //文件路径
	Ext     string //文件扩展名
	Name    string //文件名
	Size    int64  //文件大小
	ModTime int64  //文件修改时间戳
}

返回的目录扫描结果

func ScanFiles

func ScanFiles(dir string) (fl []FileList, err error)

目录扫描 @param dir 需要扫描的目录 @return fl 文件列表 @return err 错误

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL