Documentation
¶
Index ¶
- Constants
- Variables
- func MoveURL(fl *File, targetURL string, s3configFile path.Local, testonly bool) error
- func Run(configFile path.Local, s3configFile path.Local, isTest bool) error
- type Config
- type Definition
- type File
- type FileProp
- type Files
- type Matcher
- type Matchers
- type Property
- type Rule
- type S3Config
- type S3Hosts
Constants ¶
View Source
const ( PropertyName = "name" PropertyNameSolo = "name_solo" PropertyExt = "ext" PropertyMinSize = "minsize" PropertyMaxSize = "maxsize" PropertyMimeType = "mime-type" PropertyDate = "date" PropertyDrive = "drive" PropertyPath = "path" PropertyDir = "dir" PropertyAll = "all" PropertyOther = "other" )
Variables ¶
View Source
var FuncMap = template.FuncMap{}
Functions ¶
Types ¶
type Config ¶
type Config struct { Definitions []Definition Rules map[string]Rule }
Config consits of a map of rules (name to Rule), that define how and when a file is moved somewhere, and a set of defintions that define for which paths which rules do apply.
type Definition ¶ added in v0.0.3
Definition defines a set of paths (Sources) and the names of the Rules that should handle them. The first rule that matches wins.
type File ¶ added in v0.0.3
type Property ¶
type Property struct { // Name is the name of the property Name string // value is only relevant for comparisions, e.g. the int to compare minsize against Val any }
Property is a property of a file
type Rule ¶
Rule defines a set of Matchers. If any of these matches, the URLPattern is applied for moving accordingly. URLPattern is a go text-template. it is given a map so all properties of a file can be accesses via {{ index . "propname" }}. The following properties are always available:
"name" (name of the file, including extension) "name_solo" (name of the file, without extension) "ext" (extension, without the dot) "dir" (the name of the parent directory) "path" (the full path of the parent directory) "mime-type" (the mimetype) "date" (the date in format YYYY-MM-DD) "drive" (the mountpoint, e.g. /c/ for the windows drive C:\) furthermore, within matchers there can be matched against "minsize" (matches all files with this minimum size in bytes) "maxsize" (matches all files up to this maximum size in bytes)
Click to show internal directories.
Click to hide internal directories.