Documentation
¶
Overview ¶
Package dupe provides core duplicate file detection functionality.
Index ¶
- Constants
- Variables
- func Bucket(name string) parse.Bucket
- func Match(path, match string) string
- func Print(quiet, exact bool, term string, m *database.Matches) string
- func PrintRM(path string, err error) string
- func PrintWalk(lookup bool, c *Config) string
- func SkipDirectory(name string) error
- func SkipFS(dir, file, regular bool, d fs.DirEntry) error
- func SkipFile(name string) bool
- type Config
- func (c *Config) Checksum(db *bolt.DB, name, bucket string) error
- func (c *Config) Clean(w io.Writer) errordeprecated
- func (c *Config) Debugger(s string)
- func (c *Config) DelDirsExcept() ([]string, error)
- func (c *Config) DelDupeFiles() (string, error)
- func (c *Config) DelEmptyDirs(w io.Writer) error
- func (c *Config) Print() (string, error)
- func (c *Config) Read(db *bolt.DB, bucket parse.Bucket, name, mimeExt string) error
- func (c *Config) Read7Zip(db *bolt.DB, bucket parse.Bucket, name string) error
- func (c *Config) Remove() (string, error)deprecated
- func (c *Config) Removes() ([]string, error)deprecated
- func (c *Config) StatSource() (bool, int, int, error)
- func (c *Config) Status() string
- func (c *Config) WalkArchiver(db *bolt.DB, bucket parse.Bucket) error
- func (c *Config) WalkDir(db *bolt.DB, bucket parse.Bucket) error
- func (c *Config) WalkDirs(db *bolt.DB) error
- func (c *Config) WalkSource() error
- func (c *Config) Writer(w io.Writer, s string)
Constants ¶
const (
WinOS = "windows"
)
Variables ¶
var ( ErrFileEmpty = errors.New("file is empty, being 0 byte in size") ErrNilConfig = errors.New("config cannot be nil") ErrNoMatch = errors.New("no match found") ErrNoNamedBucket = errors.New("a named bucket is required") ErrPathEmpty = errors.New("path is empty") ErrPathIsFile = errors.New("path is a file") ErrPathExist = errors.New("path exists in the database bucket") ErrPathNoFound = errors.New("path does not exist") ErrPathTraversal = errors.New("path traversal attempt detected") )
Functions ¶
func SkipDirectory ¶ added in v1.2.2
SkipDirectory tells WalkDir to ignore specific system and hidden directories. This function should only be called for directories, not files.
Types ¶
type Config ¶
type Config struct {
parse.Scanner
Debug bool // Debug spams technobabble to stdout.
Quiet bool // Quiet the feedback sent to stdout.
Yes bool // Yes is assumed for all user questions and prompts.
Test bool // Test toggles the internal unit test mode.
}
Config options.
func (*Config) Checksum ¶
Checksum the named file and save it to the bucket. The saved checksum is a SHA256 hash.
func (*Config) DelDirsExcept ¶ added in v1.2.2
DelDirsExcept the directories from the source that do not contain unique MS-DOS or Windows programs. The strings contains the path of any non-deletable files.
func (*Config) DelDupeFiles ¶ added in v1.2.2
DelDupeFiles duplicate files from the source directory.
func (*Config) DelEmptyDirs ¶ added in v1.2.2
DelEmptyDirs removes all empty directories from c.Source. Directories containing hidden system directories or files are not considered empty.
func (*Config) Read7Zip ¶
Read7Zip opens the named 7-Zip archive, hashes and saves the content to the bucket.
func (*Config) StatSource ¶
StatSource returns the number of files found in the source to check.
If the given source is a file, the total number of files value will always be 1.
The func returns the following results,
- the boolean is true when the source is a directory
- the first int are the total number of files in the source
- the second int are the number of items in the buckets for the dupe check
func (*Config) WalkArchiver ¶
WalkArchiver walks the bucket directory saving the checksums of new files to the database. Any archived files supported by archiver will also have its content hashed. Archives within archives are currently left unwalked.
func (*Config) WalkDir ¶
WalkDir walks the named bucket directory for any new files to add their checksums to the database.
func (*Config) WalkDirs ¶
WalkDirs walks the named bucket directories for any new files to add their checksums to the database.
func (*Config) WalkSource ¶
WalkSource walks the source directory or a file to collect the hashed content for a future comparison.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
archive
Package archive provides archive file handling and MIME type detection.
|
Package archive provides archive file handling and MIME type detection. |
|
Package parse provides file parsing and checksum calculation functionality.
|
Package parse provides file parsing and checksum calculation functionality. |