Documentation
¶
Overview ¶
Package for working with directories
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirExists ¶
DirExists If the path exists, return true, otherwise return false - path: the path to check - returns: true if the path exists, otherwise false
func MakeDirAll ¶
MakeDirAll creates a directory and all its parent directories if they don't exist
- filename: the name of the file to create - returns: an error if there is one
func MakeDirAllWithRemove ¶
MakeDir creates a directory if it does not exist and returns a function to remove it
Example:
undoDir, err := MakeDirAllWithRemove(outputFilePath, 0755)
if err != nil {
return err
}
defer func() {
if err != nil {
undoDir()
}
}()
- dirPath: the path to the directory to create - perm: the permissions to set on the directory - returns: a function to remove the directory and an error if there is one
func RemoveContents ¶
RemoveContents removes all the contents of a directory - dir: the directory to remove the contents of - returns: an error if there is one
Types ¶
This section is empty.