fileutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(from, to string) error

CopyDir recursively copies all files and directories in the from directory into the to directory. If the to directory does not exist, it is created. If the to directory already exists, its contents are overwritten.

func CopyFile

func CopyFile(srcPath, destPath string) (err error)

CopyFile copies src to dst. If the target file already exists, it is overwritten. If the copy fails, the target file may be left in an inconsistent state.

func EscapeFilename

func EscapeFilename(s string) string

EscapeFilename replaces bad characters in a filename with safe equivalents. The only character disallowed on Unix systems is the path separator "/". Windows is more restrictive; banned characters on Windows are listed here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

func Move

func Move(oldPath, newPath string) error

Move moves a file from a directory to another, while handling cross-filesystem moves properly. If the target file already exists, it is truncated. If the move fails, then the target file may be left in an inconsistent state.

Types

This section is empty.

Jump to

Keyboard shortcuts

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