fsutil

package
v1.15.13 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 13 Imported by: 130

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanFilename

func CleanFilename(in string) string

CleanFilename strips all possibly suspicious characters from a filename WARNING: NOT suiteable for pathnames as slashes will be stripped as well!

func CleanPath

func CleanPath(path string) string

CleanPath resolves common aliases in a path and cleans it as much as possible.

func CopyFile added in v1.14.1

func CopyFile(from, to string) error

CopyFile copies a file from src to dst. Permissions will be preserved. It is expected to fail if the destination does exist but is not writeable.

func CopyFileForce added in v1.14.1

func CopyFileForce(from, to string) error

CopyFileForce copies a file from src to dst. Permissions will be preserved. The destination if removed before copying to avoid permission issues.

func ExpandHomedir added in v1.15.3

func ExpandHomedir(path string) string

ExpandHomedir expands the tilde to the users home dir (if present).

func FileContains added in v1.12.6

func FileContains(path, needle string) bool

FileContains searches the given file for the search string and returns true iff it's an exact (substring) match.

func IsEmptyDir

func IsEmptyDir(path string) (bool, error)

IsEmptyDir checks if a certain path is an empty directory.

func IsFile

func IsFile(path string) bool

IsFile checks if a certain path is actually a file.

func IsNonEmptyFile added in v1.15.3

func IsNonEmptyFile(path string) bool

IsNonEmptyFile checks if a certain path is a regular file and non-zero in size.

func Shred

func Shred(path string, runs int) error

Shred overwrite the given file any number of times.

func Umask

func Umask() int

Umask extracts the umask from env.

Types

This section is empty.

Jump to

Keyboard shortcuts

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