fileutil

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseFile

func CloseFile(file *os.File)

CloseFile closes a file and logs an error if it occurs.

func CopyEmbeddedFile

func CopyEmbeddedFile(fs embed.FS, file, dst string) error

CopyEmbeddedFile copies an embedded file to a destination.

func DeleteDirectoryIfEmpty

func DeleteDirectoryIfEmpty(path string) error

DeleteDirectoryIfEmpty checks if the specified directory is empty. If it is empty, the directory is removed.

func IsDirectoryEmpty

func IsDirectoryEmpty(name string) (bool, error)

IsDirectoryEmpty check if the requested directory is empty

func IsExistingPath

func IsExistingPath(name string) (bool, error)

IsExistingPath check if the requested path exists

func IsFileNameValid

func IsFileNameValid(name string) bool

IsFileNameValid returns true if the name is a valid file name.

func MoveFiles

func MoveFiles(sourceDir, destinationDir string) error

MoveFiles moves all files from the source directory to the destination directory

func PathJoin added in v0.0.3

func PathJoin(elem ...string) string

PathJoin returns uniformized path from joins path elements

func PathUniformize added in v0.0.3

func PathUniformize(path string) string

PathUniformize returns uniformized path regarding the device OS.

func ValidFileName

func ValidFileName(which int, optional bool) cobra.PositionalArgs

ValidFileName returns an error if the which arg is not a valid file name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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