Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileSpaceSeparatedPatterns ¶
CompileSpaceSeparatedPatterns takes a string of space separated regexes and compiles them into regex state machines. If the input is empty, an empty array is returned with no errors If any error occurs while compiling one of the patterns, that error is returned along with whatever patterns where previously compiled.
func PrintDuplicates ¶
func PrintDuplicates(duplicates []DuplicateFile)
PrintDuplicates print the duplicate to stdout
Types ¶
type Directory ¶
Directory holds the collected information about a directory
func CollectFiles ¶
func CollectFiles(options FileCollectionOptions) (Directory, error)
CollectFiles Recursively walks the provided directory and processes each file and directory it encounters This function will return, in order, a list of all the files it encountered, a list of files that were hashed, and an error if one is encountered.
type DuplicateFile ¶
DuplicateFile holds original and duplicate FileHashes
func FindDuplicateFiles ¶
func FindDuplicateFiles(directory Directory) []DuplicateFile
FindDuplicateFiles does as it suggests
func (DuplicateFile) String ¶
func (duplicate DuplicateFile) String() string
type DuplicateFileCache ¶
type DuplicateFileCache struct {
// contains filtered or unexported fields
}
DuplicateFileCache holds a cache of possible duplicate muka
func (*DuplicateFileCache) Add ¶
func (cache *DuplicateFileCache) Add(hash FileHash)
Add adds a FileHash to the cache accounting for possible duplicates
func (*DuplicateFileCache) GetDuplicates ¶
func (cache *DuplicateFileCache) GetDuplicates() []DuplicateFile
GetDuplicates retrieves the list of duplicates from the cache
type FileCollectionOptions ¶
type FileCollectionOptions struct { DirectoryToSearch string ExcludeDirs []*regexp.Regexp ExcludeFiles []*regexp.Regexp }
FileCollectionOptions options used by CollectFiles
type FileHash ¶
FileHash defines the file hash
func ForceDelete ¶
func ForceDelete(duplicates []DuplicateFile, deleter Deleter) []FileHash
ForceDelete deletes the duplicates without asking for user interventionand returns all of the deleted files
func PromptToDelete ¶
func PromptToDelete(writer io.Writer, reader io.Reader, deleter Deleter, dup DuplicateFile) ([]FileHash, error)
PromptToDelete this function interactively prompts the user to delete the duplicate and returns any files the user has deleted
type FileSizeCache ¶
FileSizeCache is a mapping between the size of a file and the count
type Report ¶
type Report struct { CollectedFileCount int CollectedFileSizeInKB float64 DuplicateFileCount int DuplicateFileSizeInKB float64 DuplicatePercentage float64 DeletedFileCount int DeletedFileSizeInKB float64 }
Report reports on program performance
func CalculateReport ¶
func CalculateReport(directory Directory, duplicates []DuplicateFile, deletedFiles []FileHash) Report
CalculateReport Generates a report detailing basic program behavior