Documentation ¶
Index ¶
- func CopyDir(src string, dst string) error
- func CopyFile(src string, dst string) error
- func FgrepStringInFile(fullPath string, needle string) (bool, error)
- func FileExists(name string) bool
- func ListFilesInDir(path string) ([]string, error)
- func PurgeDirectory(path string) error
- func RandomFilenameBase() string
- func ReplaceStringInFile(searchString string, replaceString string, origPath string, destPath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped. Credit @m4ng0squ4sh https://gist.github.com/m4ng0squ4sh/92462b38df26839a3ca324697c8cba04
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage. Credit @m4ng0squ4sh https://gist.github.com/m4ng0squ4sh/92462b38df26839a3ca324697c8cba04
func FgrepStringInFile ¶
FgrepStringInFile is a small hammer for looking for a literal string in a file. It should only be used against very modest sized files, as the entire file is read into a string.
func ListFilesInDir ¶ added in v0.15.0
ListFilesInDir returns an array of files found in a directory
func PurgeDirectory ¶
PurgeDirectory removes all of the contents of a given directory, leaving the directory itself intact.
func RandomFilenameBase ¶ added in v0.18.0
func RandomFilenameBase() string
RandomFilenameBase generates a temporary filename for use in testing or whatever. From https://stackoverflow.com/a/28005931/215713
Types ¶
This section is empty.