files

package
v0.0.0-...-746562c Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IsDirectory = iota
	IsRegular
	IsSymlink
)

Variables

This section is empty.

Functions

func CopyPaths

func CopyPaths(targetDir string, c <-chan *FileCopy, verbose bool) error

write chan file to targetDir after WalkPaths(srcDir, suffix string, c chan<- *FileCopy) targetDir -> targetDir c -> WalkPaths return chan verbose -> is show log

func IsFileExist

func IsFileExist(filePath string) bool

is file exist filePath -> path of file

func IsPathExist

func IsPathExist(path string) bool

is path exist, most of this use check folder path -> path for check

func ListDirFiles

func ListDirFiles(dirPath string, suffix string) (files []string, err error)

List DirPath all file, ignore sub folder dirPth -> for walk path suffix -> suffix want, if "" not check, ignore the case of suffix matching

func ListSubDirs

func ListSubDirs(dirPath string) (folder []string, err error)

List DirPath all sub-folder, ignore sub Dirs dirPth -> for walk path

func ReadFileAsString

func ReadFileAsString(filePath string) (string, error)

read file content as string filePath -> path of file

func WalkDirFileAll

func WalkDirFileAll(dirPath, suffix string) (files []string, err error)

can get full file and in sub-folder file, ignore folder name dirPth -> for walk path suffix -> suffix want, if "" not check, ignore the case of suffix matching

func WalkDirFolderAll

func WalkDirFolderAll(dirPath string) (folder []string, err error)

can get full folder and in sub-folder folder, ignore all file, and including itself dirPth -> for walk path

func WalkPaths

func WalkPaths(srcDir, suffix string, c chan<- *FileCopy)

walk path, and send file to chan if want suffix file, just like go WalkPaths(mockFrom, ".txt", cpInfoChan) srcDir -> for make src dir suffix -> suffix for copy c -> walk chan, all most make as cpInfoChan := make(chan *FileCopy, 10)

Types

type FileCopy

type FileCopy struct {
	RealPath string
	Size     int64
	IsDir    bool
	Mode     os.FileMode
	Handle   *os.File
}

type FileMerge

type FileMerge struct {
	// contains filtered or unexported fields
}

func (*FileMerge) MergeFolderPath

func (f *FileMerge) MergeFolderPath(sourceDir string, targetDir string) error

Jump to

Keyboard shortcuts

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