Documentation
¶
Index ¶
- Variables
- func DirSize(path string) (int64, error)
- func RemoveDuplicateStr(strSlice []string) []string
- func ResultLog(extensions int, o *Operator, startTime time.Time)
- func ValidateDir(dirp string) error
- type CSVLogger
- type Config
- type Flags
- type Operator
- func (o *Operator) AddType(ext, fp string) string
- func (o *Operator) AsyncProcessDir(dirpath string, r bool) (int, error)
- func (o *Operator) BuildStorageMaps(c *Config)
- func (o *Operator) Copy(dstPath, dstDir, specialDir, fileAbsolutePath string) error
- func (o *Operator) CreateSubdirs(dstBasePath string, rules []Rule) error
- func (o *Operator) GetExtensionCategory(ext string) (string, bool)
- func (o *Operator) GetSeparateSubdirs(category, ext string) string
- func (o *Operator) GetSortSubDirs(category string) (string, bool)
- func (o *Operator) Operate() (int, error)
- func (o *Operator) ProcessDir(dirpath string, r bool) (int, error)
- type Override
- type Rule
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoCreateDate = errors.New("given file doesn't have a CreateDate field or we failed to find it")
Functions ¶
func RemoveDuplicateStr ¶
func ValidateDir ¶
Types ¶
type CSVLogger ¶
type CSVLogger struct {
// contains filtered or unexported fields
}
CSVLogger writes log entries into a CSV file with three columns: sourceFileName, destinationFileName, SUCCESS/FAILURE.
func NewCSVLogger ¶
NewCSVLogger creates or truncates a CSV file and writes the header row.
type Config ¶
func ReadCategories ¶
type Flags ¶
type Operator ¶
type Operator struct {
Storage Storage
Flags Flags
CsvHandler *CSVLogger
SubDirCount int
ExtensionCount int
// contains filtered or unexported fields
}
func GetNewOperator ¶
func (*Operator) AsyncProcessDir ¶
func (*Operator) BuildStorageMaps ¶
func (*Operator) CreateSubdirs ¶
func (*Operator) GetExtensionCategory ¶
func (*Operator) GetSeparateSubdirs ¶
type Rule ¶
type Rule struct {
Category string `yaml:"category"`
Separate []string `yaml:"separate"`
Extensions []string `yaml:"extensions,omitempty"`
NameContains []string `yaml:"name_contains,omitempty"`
Sort string `yaml:"sort,omitempty"` // month&year is only possible options
}
func (Rule) SeparateExists ¶
type Storage ¶
type Storage struct {
Entries []os.DirEntry
Categories map[string][]string // [categories][]extensions
Extensions map[string]string // [extensions][categories]
OutDirectories map[string][]string // []categories[files]
SubDirs map[string][]string // [subDir][]extensions
Unprocessed []string
SortMap map[string]string //image:year, videos:month, documents:month
Exif *exiftool.Exiftool
}
func NewStorage ¶
func NewStorage() *Storage
Click to show internal directories.
Click to hide internal directories.