diff --git a/cmd/bisync/deltas.go b/cmd/bisync/deltas.go index 9d565eba6..87e274d0e 100644 --- a/cmd/bisync/deltas.go +++ b/cmd/bisync/deltas.go @@ -174,18 +174,21 @@ func (b *bisyncRun) findDeltas(fctx context.Context, f fs.Fs, oldListing, newLis ds.deleted++ d |= deltaDeleted } else { - if old.getTime(file) != now.getTime(file) { - if old.beforeOther(now, file) { - fs.Debugf(file, "(old: %v current: %v", old.getTime(file), now.getTime(file)) - b.indent(msg, file, "File is newer") - d |= deltaNewer - } else { // Current version is older than prior sync. - fs.Debugf(file, "(old: %v current: %v", old.getTime(file), now.getTime(file)) - b.indent(msg, file, "File is OLDER") - d |= deltaOlder + // skip dirs here, as we only care if they are new/deleted, not newer/older + if !now.isDir(file) { + if old.getTime(file) != now.getTime(file) { + if old.beforeOther(now, file) { + fs.Debugf(file, "(old: %v current: %v", old.getTime(file), now.getTime(file)) + b.indent(msg, file, "File is newer") + d |= deltaNewer + } else { // Current version is older than prior sync. + fs.Debugf(file, "(old: %v current: %v", old.getTime(file), now.getTime(file)) + b.indent(msg, file, "File is OLDER") + d |= deltaOlder + } } + // TODO Compare sizes and hashes } - // TODO Compare sizes and hashes } if d.is(deltaModified) { diff --git a/cmd/bisync/listing.go b/cmd/bisync/listing.go index 4a71d1500..a6474b78a 100644 --- a/cmd/bisync/listing.go +++ b/cmd/bisync/listing.go @@ -128,6 +128,17 @@ func (ls *fileList) getTime(file string) time.Time { return fi.time } +// also returns false if not found +func (ls *fileList) isDir(file string) bool { + fi := ls.get(file) + if fi != nil { + if fi.flags == "d" { + return true + } + } + return false +} + func (ls *fileList) beforeOther(other *fileList, file string) bool { thisTime := ls.getTime(file) thatTime := other.getTime(file)