Documentation
¶
Overview ¶
Package filesystem implements things like moving files, copying them, etc.
Index ¶
- Variables
- func AnyFileNewerThan(path string, givenTime time.Time) (bool, error)
- func CheckFileExists(path string) error
- func CopyDir(pathSource, pathDestination string) error
- func CopyFile(pathSource, pathDestination string) error
- func DirTree(root string) ([]string, error)
- func GetFileModTime(filePath string) (time.Time, error)
- func LoadLastRunTime(pathLastRun string) (time.Time, error)
- func MoveFile(pathSource, pathDestination string) error
- func SaveCurrentRunTime(pathLastRun string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyPath is returned when function is called with empty path parameter ErrEmptyPath = errors.New("provided path is empty") // ErrPathIsDirectory is returned when path exists, but is a directory and not a file ErrPathIsDirectory = fmt.Errorf("provided path is directory: %w", os.ErrExist) // ErrFileNotRegular is returned when path exists, but is not a regular file ErrFileNotRegular = errors.New("file is not regular file") // ErrFileModified is returned when a file in given path was modified ErrFileModified = errors.New("file has been modified since") )
Functions ¶
func AnyFileNewerThan ¶
AnyFileNewerThan checks recursively if any file in given path (can be directory or file) has modification time newer than the given time. Returns: - true if a newer file is found - false if no newer file is found or givenTime is zero Function is lazy, and returns on first positive occurrence.
func CheckFileExists ¶
CheckFileExists checks if file exists at PATH
func GetFileModTime ¶
GetFileModTime returns modification time of a file
func LoadLastRunTime ¶
LoadLastRunTime loads time of the last execution from file
func SaveCurrentRunTime ¶
SaveCurrentRunTime writes the current time into file
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.