dir

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package for working with directories

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExists

func DirExists(path string) bool

DirExists If the path exists, return true, otherwise return false - path: the path to check - returns: true if the path exists, otherwise false

func MakeDirAll

func MakeDirAll(filename string) error
MakeDirAll creates a directory and all its parent directories if they don't exist

- filename: the name of the file to create - returns: an error if there is one

func MakeDirAllWithRemove

func MakeDirAllWithRemove(dirPath string, perm os.FileMode) (func(), error)

MakeDir creates a directory if it does not exist and returns a function to remove it

Example:
undoDir, err := MakeDirAllWithRemove(outputFilePath, 0755)
if err != nil {
	return err
}
defer func() {
	if err != nil {
		undoDir()
	}
}()

- dirPath: the path to the directory to create - perm: the permissions to set on the directory - returns: a function to remove the directory and an error if there is one

func RemoveContents

func RemoveContents(dir string) error

RemoveContents removes all the contents of a directory - dir: the directory to remove the contents of - returns: an error if there is one

func ZipFolder

func ZipFolder(ZipFile string, zipFolder string) error

ZipFolder zips a folder and all its contents - ZipFile: the name of the zip file to create - zipFolder: the folder to zip - returns: an error if there is one

Types

This section is empty.

Jump to

Keyboard shortcuts

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