Documentation ¶
Index ¶
- func SortedKeys(m map[string]int64) []string
- type Counters
- type DUtil
- type DirCount
- func (d *DirCount) AddFile(dir string, fInfo os.FileInfo)
- func (d *DirCount) Counters() string
- func (d *DirCount) GetTop() map[string]int64
- func (d *DirCount) Inc(path string, size int64)
- func (d *DirCount) PrintFiles(topFiles int, summary bool)
- func (d *DirCount) WriteMeta(file string)
- func (d *DirCount) WriteMetaSortedByDate(file string)
- func (d *DirCount) WriteMetaSortedBySize(file string)
- type Duplicate
- type Meta
- type SortedFileBySize
- type SortedMetaByDate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortedKeys ¶
SortedKeys takes a dictionary and returns a sorted slice of keys
Types ¶
type Counters ¶
type DUtil ¶
type DUtil interface { Inc(path string, size int64) // increment totals per dir WriteMeta(file string) // write Meta data in json format WriteMetaSortedByDate(file string) // write meta data sorted by date WriteMetaSortedBySize(file string) // write meta data sorted by file size Counters() Counters // return various counters }
DUtil is an interface to describe utilities that are used for directory traversal and collect meta data
type DirCount ¶
type DirCount struct { Meta map[string]*Meta // file name (not absolute path) -> meta data map // contains filtered or unexported fields }
DirCount is used to store byte totals for all files in specified dir along with meta data
func NewDirCount ¶
NewDirCount is a function that returns a new DirCount that implements DUtil
func (*DirCount) PrintFiles ¶
PrintFiles prints top files disk usage similar to du
func (*DirCount) WriteMetaSortedByDate ¶
WriteMetaSortedByDate prints meta data sorted by date
func (*DirCount) WriteMetaSortedBySize ¶
WriteMetaSortedBySize writes meta data sorted by file size
type Meta ¶
type Meta struct { Name string // base file name Size int64 Modtime time.Time types.Type Exif exif2.Exif FileSizeMismatch bool Dups []Duplicate // potential list of duplicates }
Meta stores metadata about the file such as os.stat info, filetype info
type SortedFileBySize ¶
type SortedFileBySize []*Meta
SortedFileBySize sorts files by size held in metadata
func (SortedFileBySize) Len ¶
func (s SortedFileBySize) Len() int
func (SortedFileBySize) Less ¶
func (s SortedFileBySize) Less(i, j int) bool
func (SortedFileBySize) Swap ¶
func (s SortedFileBySize) Swap(i, j int)
type SortedMetaByDate ¶
type SortedMetaByDate []*Meta
SortedMetaByDate interface types for SortedMetaByDate
func (SortedMetaByDate) Len ¶
func (s SortedMetaByDate) Len() int
func (SortedMetaByDate) Less ¶
func (s SortedMetaByDate) Less(i, j int) bool
func (SortedMetaByDate) Swap ¶
func (s SortedMetaByDate) Swap(i, j int)