import "github.com/rclone/rclone/fs/filter"
Package filter controls the filtering of files
var DefaultOpt = Opt{ MinAge: fs.DurationOff, MaxAge: fs.DurationOff, MinSize: fs.SizeSuffix(-1), MaxSize: fs.SizeSuffix(-1), }
DefaultOpt is the default config for the filter
ReplaceConfig replaces the filter config in the ctx with the one passed in and returns a new context with that added to it.
FilesMap describes the map of files to transfer
type Filter struct { Opt Opt ModTimeFrom time.Time ModTimeTo time.Time // contains filtered or unexported fields }
Filter describes any filtering in operation
AddConfig returns a mutable config structure based on a shallow copy of that found in ctx and returns a new context with that added to it.
GetConfig returns the global or context sensitive config
NewFilter parses the command line options and creates a Filter object. If opt is nil, then DefaultOpt will be used
Add adds a filter rule with include or exclude status indicated
AddFile adds a single file to the files from list
AddRule adds a filter rule with include/exclude indicated by the prefix
These are
+ glob - glob !
'+' includes the glob, '-' excludes it and '!' resets the filter list
Line comments may be introduced with '#' or ';'
Clear clears all the filter rules
func (f *Filter) DirContainsExcludeFile(ctx context.Context, fremote fs.Fs, remote string) (bool, error)
DirContainsExcludeFile checks if exclude file is present in a directory. If fs is nil, it works properly if ExcludeFile is an empty string (for testing).
DumpFilters dumps the filters in textual form, 1 per line
Files returns all the files from the `--files-from` list
It may be nil if the list is empty
HaveFilesFrom returns true if --files-from has been supplied
InActive returns false if any filters are active
Include returns whether this object should be included into the sync or not
IncludeDirectory returns a function which checks whether this directory should be included in the sync or not.
IncludeObject returns whether this object should be included into the sync or not. This is a convenience function to avoid calling o.ModTime(), which is an expensive operation.
func (f *Filter) ListContainsExcludeFile(entries fs.DirEntries) bool
ListContainsExcludeFile checks if exclude file is present in the list.
func (f *Filter) MakeListR(ctx context.Context, NewObject func(ctx context.Context, remote string) (fs.Object, error)) fs.ListRFn
MakeListR makes function to return all the files set using --files-from
UsesDirectoryFilters returns true if the filter uses directory filters and false if it doesn't.
This is used in deciding whether to walk directories or use ListR
type Opt struct { DeleteExcluded bool FilterRule []string FilterFrom []string ExcludeRule []string ExcludeFrom []string ExcludeFile string IncludeRule []string IncludeFrom []string FilesFrom []string FilesFromRaw []string MinAge fs.Duration MaxAge fs.Duration MinSize fs.SizeSuffix MaxSize fs.SizeSuffix IgnoreCase bool }
Opt configures the filter
Path | Synopsis |
---|---|
filterflags | Package filterflags implements command line flags to set up a filter |
Package filter imports 13 packages (graph) and is imported by 29 packages. Updated 2020-12-12. Refresh now. Tools for package owners.