dff

package module
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: GPL-3.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Duplicate File Finder

Build Status Go Report Card Release

finds duplicate files in directories

Powered by HighwayHash hash algorithm

Duplicate file finder

  -d, --dir stringArray   Target directories
  -f, --format string     Output format [json | text] (default "text")
  -c, --min-count int     Minimum number of files in file group (default 2)
  -s, --min-size int      Minimum file size (Byte) (default 0)
  -r, --sort string       Sort by [size | total | count] (default "total")
  -v, --verbose           Verbose
Find duplicate files in a specific directory
dff -d /dir
Find duplicate files in specific directories
dff -d /dir1 -d /dir2 -d /dir3
Find duplicate files if there are 10 or more identical files (Default: 2)
dff -d /dir -c 10
Find duplicate files of 2 MB or more (Default: 1 MB)
dff -d /dir -s 2000000 
Output format

JSON (Default)

dff -d /dir -f json

Text

dff -d /dir -f text
Sort

Sort by file size sum

dff -d /dir -r total

Sort by file size

dff -d /dir -r size

Sort by duplicate count

dff -d /dir -r count
Example
option = &dff.Option{
    Dirs:                     []string{"/path/to/dir1", "/path/to/dir2"},
    MinNumOfFilesInFileGroup: 3,
    MinFileSize:              10000000,
    SortBy:                   "total",
    Format:                   "json",
}
duplicateFileFinder := dff.NewDuplicateFileFinder(option)
duplicateList, scanned, err := duplicateFileFinder.Find()
if err != nil {
    log.Error(err)
    return
}

Documentation

Overview

DFF finds duplicate files in specified directories.

Index

Constants

View Source
const (
	SortBySize = iota + 1
	SortByTotalSize
	SortByCount
)
View Source
const (
	JsonFormat = iota + 1
	TextFormat
)

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(verbose bool)

Types

type ByCount

type ByCount struct{ UniqFiles }

Sort by

func (ByCount) Less

func (s ByCount) Less(i, j int) bool

type BySize

type BySize struct{ UniqFiles }

Sort by size

func (BySize) Less

func (s BySize) Less(i, j int) bool

type ByTotalSize

type ByTotalSize struct{ UniqFiles }

Sort by total size

func (ByTotalSize) Less

func (s ByTotalSize) Less(i, j int) bool

type DuplicateFileFinder

type DuplicateFileFinder struct {
	Option *Option
	// contains filtered or unexported fields
}

DuplicateFileFinder is core of dupliate file finder

func NewDuplicateFileFinder

func NewDuplicateFileFinder(option *Option) *DuplicateFileFinder

func (*DuplicateFileFinder) Display

func (d *DuplicateFileFinder) Display(list []*UniqFile)

func (*DuplicateFileFinder) Find

func (d *DuplicateFileFinder) Find() ([]*UniqFile, int, error)

type DuplicateFileMap

type DuplicateFileMap map[[32]byte]*UniqFile

type FileDetail

type FileDetail struct {
	// contains filtered or unexported fields
}

type FileMap

type FileMap map[string]*FileDetail

type FileMapBySize

type FileMapBySize map[int64][]*FileDetail

type FileMapDetail

type FileMapDetail struct {
	// contains filtered or unexported fields
}

func NewFileMapDetail

func NewFileMapDetail(dir string) *FileMapDetail

type Option

type Option struct {
	Dirs                     []string
	MinNumOfFilesInFileGroup int
	MinFileSize              int64
	SortBy                   string
	Format                   string
}

type UniqFile

type UniqFile struct {
	List      []string
	Size      int64
	TotalSize int64
	Count     int
}

func NewDuplicateFiles

func NewDuplicateFiles(size int64) *UniqFile

type UniqFiles

type UniqFiles []*UniqFile

Sorting for UniqFile

func (UniqFiles) Len

func (s UniqFiles) Len() int

func (UniqFiles) Swap

func (s UniqFiles) Swap(i, j int)

Directories

Path Synopsis
cmd
dff command

Jump to

Keyboard shortcuts

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