Documentation
¶
Index ¶
- Constants
- func CompareFiles(source, target string) (bool, error)
- func FilterIgnore(paths []string, ignorePatterns []string, progressCb func(int64)) []string
- func IsConfigExists(path string) (bool, error)
- func ListFilesRel(log func(string, ...any), root string, progressCb func(int64), ...) ([]string, error)
- func PathWithoutExtension(path string) string
- func ProcessFiles(template string, et *exiftool.Exiftool, sourceDir, targetDir string, ...) error
- func RenderTemplate(templateStr string, fields any) (string, error)
- func TransferFile(log func(string, ...any), source, target string, dryRun, verify, move bool) (actionTaken bool, err error)
- func WriteDefaultConfigToFile(path string) error
- type Config
- type ExifMetadata
- type FileWithSidecars
- type FsMetadata
- type HashMetadata
- type Metadata
Constants ¶
const (
DefaultConfigString = `` /* 1477-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
func CompareFiles ¶
CompareFiles compares the content of two files using a hash. It returns true if the files are identical and false otherwise. It returns an error if the source file is a directory or if there is an error reading the files.
func FilterIgnore ¶
func IsConfigExists ¶
func ListFilesRel ¶
func ListFilesRel(log func(string, ...any), root string, progressCb func(int64), skipPermissionDenied bool) ([]string, error)
ListFilesRel walks the file system starting from the root and returns a list of relative file paths.
func PathWithoutExtension ¶
func ProcessFiles ¶ added in v0.0.5
func TransferFile ¶ added in v0.0.5
func TransferFile( log func(string, ...any), source, target string, dryRun, verify, move bool, ) (actionTaken bool, err error)
TransferFile copies a file from source to target path, with safety checks. It will: - Skip if source and target are identical - Error if source/target is a directory - Skip if target exists with identical content - Remove and replace target if content differs
dryRun simulates operations without making changes verify returns errors instead of executing if any action is required move indicates whether to move instead of copy
Types ¶
type Config ¶
type Config struct { Template string `yaml:"template" json:"template"` SkipPermissionDenied bool `yaml:"skipPermissionDenied" json:"skipPermissionDenied"` Ignore []string `yaml:"ignore" json:"ignore"` SidecarExtensions []string `yaml:"sidecarExtensions" json:"sidecarExtensions"` }
func DefaultConfig ¶
func DefaultConfig() *Config
func ReadConfigFromFile ¶
func ReadConfigFromString ¶
type ExifMetadata ¶
type ExifMetadata map[string]interface{}
func ExtractExifMetadata ¶
func ExtractExifMetadata( et *exiftool.Exiftool, file string, ) (ExifMetadata, error)
type FileWithSidecars ¶
func LinkSidecars ¶
func LinkSidecars( sidecarExtensions []string, files []string, ) []FileWithSidecars
type FsMetadata ¶
func ExtractFsMetadata ¶
func ExtractFsMetadata( file string, ) FsMetadata
type HashMetadata ¶
func ExtractHashMetadata ¶
func ExtractHashMetadata( file string, ) (HashMetadata, error)
type Metadata ¶
type Metadata struct { Fs FsMetadata Exif ExifMetadata Hash HashMetadata }