fs

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotDirectory = errors.New("not a directory")
)

Functions

func DeleteReadOnlyRecursive

func DeleteReadOnlyRecursive(root string) error

DeleteReadOnlyRecursive deletes the directory with path given by `root`. Prior to deleting the directory, the directory and all descendant files and directories are set as writable. If any chmod or deletion error occurs it is immediately returned.

func EnsureEmptyDirectory

func EnsureEmptyDirectory(path string, perm fs.FileMode) error

EnsureEmptyDirectory ensures the directory given by `path` is empty. If the directory does not exist, it will be created with permission bits given by `perm`. If the directory exists, it will not simply rm -rf && mkdir -p as the calling process may not have permissions to delete the directory. E.g. in the case of a pod mount. Rather, it will delete the contents of the directory.

func GetDirectoryModTime

func GetDirectoryModTime(dirPath string) (time.Time, error)

GetDirectoryModTime returns the modification time of the directory at dirPath. If stat(dirPath) fails, an error is returned with a zero-value time.Time. If dirPath is not a directory, an ErrNotDirectory error is returned.

func SetReadOnlyRecursive

func SetReadOnlyRecursive(root string) error

SetReadOnlyRecursive recursively sets files and directories under the path given by `root` as read-only

func SetWritableRecursive

func SetWritableRecursive(root string) error

SetWritableRecursive recursively sets files and directories under the path given by `root` as writable

Types

This section is empty.

Jump to

Keyboard shortcuts

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