neaten

package
v5.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ErrNoOutputsFound = Error("There are no existing files according to the provided input and output suffixes.")

Variables

This section is empty.

Functions

func CorrectPerms

func CorrectPerms(path string, destDirInfo fs.FileInfo) error

CorrectPerms checks whether the given file has the same ownership and read-write permissions as the given destDir info. If permissions do not match, they will be changed accordingly.

func CreateFile

func CreateFile(path string) error

CreateFile creates a file in the given path.

func DeleteAllPrefixedDirEntries

func DeleteAllPrefixedDirEntries(dir, prefix string) error

DeleteAllPrefixedDirEntries deletes all files and directories in the given directory that have the given prefix.

func MergeDGUTADBDirectories added in v5.1.0

func MergeDGUTADBDirectories(sourceDir, destDir string) error

MergeDGUTADBDirectories copies the dguta.db numbered subdirectories from inside sourceDir to inside destDir, renaming them so they don't conflict with existing destDir subdirectories.

func Touch

func Touch(path string) error

Touch modifies path's a and mtime to the current time.

Types

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type Tidy

type Tidy struct {
	SrcDir  string
	DestDir string

	// Date used in the renaming of files.
	Date string

	// File suffixes of combine files in the SrcDir, and their counterpart in
	// the destDir.
	CombineFileSuffixes map[string]string

	// File suffixes of db files in the SrcDir, and their counterpart in the
	// destDir.
	DBFileSuffixes map[string]string

	// File suffixes of base files in the SrcDir, and their counterpart in the
	// destDir.
	BaseFileSuffixes map[string]string

	// Glob pattern describing the path of combine files in SrcDir.
	CombineFileGlobPattern string

	// Glob pattern describing the path of db files in SrcDir.
	DBFileGlobPattern string

	// Glob pattern describing the path of walk files in SrcDir.
	WalkFilePathGlobPattern string

	// The perms of destdir if we make the destdir ourselves.
	DestDirPerms fs.FileMode
	// contains filtered or unexported fields
}

Up struct defines your source directory, suffixes and glob patterns to find input files, and information about your destination directory, so that Up() can tidy your source files to the DestDir.

func (*Tidy) Up

func (t *Tidy) Up(disableDeletion bool) error

Up takes our source directory of wrstat output files, renames them and relocates them to our dest directory, using our date. Also ensures that the permissions of wrstat output files match those of dest directory. If our dest dir doesn't exist, it will be created. And it touches a file called .dguta.db.updated, setting its mTime equal to the oldest of all those from our srcDir. Finally, deletes the source directory.

For debugging purposes, set disableDeletion to true to disable deletion of the source directory after a successful move.

Jump to

Keyboard shortcuts

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