Documentation ¶
Overview ¶
Package dupesets collects types, functions and methods for working with collections of duplicate files.
Index ¶
Constants ¶
const ( TabWriterDirectoryColumnHeaderName string = "Directory" TabWriterFileColumnHeaderName string = "File" TabWriterSizeColumnHeaderName string = "Size" TabWriterChecksumColumnHeaderName string = "Checksum" TabWriterRemoveFileColumnHeaderName string = "Remove" )
Tabwriter header names displayed in console output
Variables ¶
This section is empty.
Functions ¶
func ValidateInputRow ¶
func ValidateInputRow(dfsEntry DuplicateFileSetEntry, rowNum int) error
ValidateInputRow performs basic validation steps against fields in a DuplicateFileSetEntry to determine whether an input CSV row will be processed further
Types ¶
type DuplicateFileSetEntries ¶
type DuplicateFileSetEntries []DuplicateFileSetEntry
DuplicateFileSetEntries is a collection of DuplicateFileSetEntry objects. These objects represent rows in a CSV file containing metadata for duplicate file sets previously detected and reported by this application. If flagged (by the user), the files noted by these entries may be (optionally) backed up and removed.
func (DuplicateFileSetEntries) FilesToRemove ¶
func (dfsEntries DuplicateFileSetEntries) FilesToRemove() DuplicateFileSetEntries
FilesToRemove returns a dfsEntries object representing the files that the user has flagged for removal
func (DuplicateFileSetEntries) Print ¶
func (dfsEntries DuplicateFileSetEntries) Print(addSeparatorLine bool)
Print writes DuplicateFileSetEntry objects to a provided Writer, falling back to stdout if not specified.
type DuplicateFileSetEntry ¶
type DuplicateFileSetEntry struct { // ParentDirectory represents the directory containing a file from a // duplicate file sets ParentDirectory string // Filename is the name of a file from a duplicate file set Filename string // SizeHR is the size of a file from a duplicate file set in // human-readable text format (e.g., 1 GB, 500 MB) SizeHR string // SizeInBytes is the size of a file from a duplicate file set in bytes SizeInBytes int64 // Checksum is the file hash for a file from a duplicate file set Checksum checksums.SHA256Checksum // RemoveFile is a flag indicating whether a file from a duplicate file // set is to be removed RemoveFile bool }
DuplicateFileSetEntry represents a duplicate file set entry recorded as a row within an input CSV file. This row is expected to contain data originally generated by the `report` subcommand and a user-provided flag indicating whether one or more files from the duplicate file set are to be removed. TODO: Any logical way to merge this type definition with FileMatch? Is there a thin interface that could be created between the types? This type is very close to the existing FileMatch type.
func ParseInputRow ¶
func ParseInputRow(row []string, fieldCount int, rowNum int) (DuplicateFileSetEntry, error)
ParseInputRow evaluates each row returned from the CSV Reader returning a DuplicateFileSetEntry object if parsing succeeds, otherwise returning an error.
func (*DuplicateFileSetEntry) UpdateSizeInfo ¶
func (dfsEntry *DuplicateFileSetEntry) UpdateSizeInfo() error
UpdateSizeInfo fills in potentially missing size information for each entry in the duplicate file set.