rclone: github.com/ncw/rclone/fs/filter Index | Files | Directories

package filter

import "github.com/ncw/rclone/fs/filter"

Package filter controls the filtering of files


Package Files

filter.go glob.go


var Active = mustNewFilter(nil)

Active is the globally active filter

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

type FilesMap Uses

type FilesMap map[string]struct{}

FilesMap describes the map of files to transfer

type Filter Uses

type Filter struct {
    Opt         Opt
    ModTimeFrom time.Time
    ModTimeTo   time.Time
    // contains filtered or unexported fields

Filter describes any filtering in operation

func NewFilter Uses

func NewFilter(opt *Opt) (f *Filter, err error)

NewFilter parses the command line options and creates a Filter object. If opt is nil, then DefaultOpt will be used

func (*Filter) Add Uses

func (f *Filter) Add(Include bool, glob string) error

Add adds a filter rule with include or exclude status indicated

func (*Filter) AddFile Uses

func (f *Filter) AddFile(file string) error

AddFile adds a single file to the files from list

func (*Filter) AddRule Uses

func (f *Filter) AddRule(rule string) error

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 ';'

func (*Filter) BoundedRecursion Uses

func (f *Filter) BoundedRecursion() bool

BoundedRecursion returns true if the filter can be evaluated with bounded recursion only.

func (*Filter) Clear Uses

func (f *Filter) Clear()

Clear clears all the filter rules

func (*Filter) DirContainsExcludeFile Uses

func (f *Filter) DirContainsExcludeFile(fremote fs.Fs, remote string) (bool, error)

DirContainsExcludeFile checks if exclude file is present in a directroy. If fs is nil, it works properly if ExcludeFile is an empty string (for testing).

func (*Filter) DumpFilters Uses

func (f *Filter) DumpFilters() string

DumpFilters dumps the filters in textual form, 1 per line

func (*Filter) Files Uses

func (f *Filter) Files() FilesMap

Files returns all the files from the `--files-from` list

It may be nil if the list is empty

func (*Filter) HaveFilesFrom Uses

func (f *Filter) HaveFilesFrom() bool

HaveFilesFrom returns true if --files-from has been supplied

func (*Filter) InActive Uses

func (f *Filter) InActive() bool

InActive returns false if any filters are active

func (*Filter) Include Uses

func (f *Filter) Include(remote string, size int64, modTime time.Time) bool

Include returns whether this object should be included into the sync or not

func (*Filter) IncludeDirectory Uses

func (f *Filter) IncludeDirectory(fs fs.Fs) func(string) (bool, error)

IncludeDirectory returns a function which checks whether this directory should be included in the sync or not.

func (*Filter) IncludeObject Uses

func (f *Filter) IncludeObject(o fs.Object) bool

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 (*Filter) ListContainsExcludeFile Uses

func (f *Filter) ListContainsExcludeFile(entries fs.DirEntries) bool

ListContainsExcludeFile checks if exclude file is present in the list.

func (*Filter) MakeListR Uses

func (f *Filter) MakeListR(NewObject func(remote string) (fs.Object, error)) fs.ListRFn

MakeListR makes function to return all the files set using --files-from

type Opt Uses

type Opt struct {
    DeleteExcluded bool
    FilterRule     []string
    FilterFrom     []string
    ExcludeRule    []string
    ExcludeFrom    []string
    ExcludeFile    string
    IncludeRule    []string
    IncludeFrom    []string
    FilesFrom      []string
    MinAge         fs.Duration
    MaxAge         fs.Duration
    MinSize        fs.SizeSuffix
    MaxSize        fs.SizeSuffix
    IgnoreCase     bool

Opt configures the filter


filterflagsPackage filterflags implements command line flags to set up a filter

Package filter imports 12 packages (graph) and is imported by 24 packages. Updated 2019-05-14. Refresh now. Tools for package owners.