1
mirror of https://github.com/rclone/rclone synced 2024-11-10 08:08:35 +01:00

filter: fix --min-age and --max-age together check

Somehow in the code reorganisation of
11da2a6c9b the check for --min-age and
--max-age got switched around.  This commit fixes that and means you
can use --min-age and --max-age together.
This commit is contained in:
Nick Craig-Wood 2018-04-26 09:17:22 +01:00
parent a703216286
commit 764440068e

View File

@ -130,7 +130,7 @@ func NewFilter(opt *Opt) (f *Filter, err error) {
}
if f.Opt.MaxAge.IsSet() {
f.ModTimeFrom = time.Now().Add(-time.Duration(f.Opt.MaxAge))
if !f.ModTimeTo.IsZero() && f.ModTimeFrom.Before(f.ModTimeTo) {
if !f.ModTimeTo.IsZero() && f.ModTimeTo.Before(f.ModTimeFrom) {
log.Fatal("filter: --min-age can't be larger than --max-age")
}
fs.Debugf(nil, "--max-age %v to %v", f.Opt.MaxAge, f.ModTimeFrom)