Documentation
¶
Index ¶
- Constants
- func CleanPath(path string) string
- func CollectHashes(fileGroups map[int][]FileInfo, singleThread bool, algorithm string, flat bool, ...) map[string][]FileInfo
- func GetAlgorithm(al string) string
- func GetDuplicates(hashes map[string][]FileInfo) ([][]FileInfo, int, int)
- func GetFileHash(path, algorithm string) (string, error)
- func GroupFiles(files []FileInfo, minSize int) (map[int][]FileInfo, int)
- func RemoveDuplicates(fileSets [][]FileInfo) (int, int, error)
- type FileInfo
Constants ¶
const ( // XXHash represents XXHash algorithm XXHash = "xxhash" // MD5 represents XXHash algorithm MD5 = "md5" // SHA256 represents XXHash algorithm SHA256 = "sha256" )
Variables ¶
This section is empty.
Functions ¶
func CollectHashes ¶
func CollectHashes(fileGroups map[int][]FileInfo, singleThread bool, algorithm string, flat bool, fileCount int) map[string][]FileInfo
CollectHashes returns hashes for the given group files if there is more than one file with the same size A hash will be the key and a list of FileInfo for files that share the hash as the value "singleThread=false" will force all the function to use one thread only minSize is the minimum file size to scan "flat=true" will tell the function not to print out any data other than the path to duplicate files algorithm is the algorithm to calculate the hash with
func GetAlgorithm ¶
GetAlgorithm matches the given string to one of the supported algorithms Returns md5 if a match wasn't found
func GetDuplicates ¶
GetDuplicates scans the given map of hashes and finds the one with duplicates It will return a slice containing slices with each slice containing paths to duplicate files It will also returns the total of duplicate files and the total of files that have duplicates
func GetFileHash ¶
GetFileHash returns given file hash using the provided algorithm Default: md5
func GroupFiles ¶
GroupFiles groups files based on their file size This will help avoid unnecessary hash calculations since files with different file sizes can't be duplicates