parent
8aeca6c033
commit
237daa8aaf
2 changed files with 12 additions and 4 deletions
|
@ -74,7 +74,8 @@ Now the `dedupe` session
|
||||||
s) Skip and do nothing
|
s) Skip and do nothing
|
||||||
k) Keep just one (choose which in next step)
|
k) Keep just one (choose which in next step)
|
||||||
r) Rename all to be different (by changing file.jpg to file-1.jpg)
|
r) Rename all to be different (by changing file.jpg to file-1.jpg)
|
||||||
s/k/r> k
|
q) Quit
|
||||||
|
s/k/r/q> k
|
||||||
Enter the number of the file to keep> 1
|
Enter the number of the file to keep> 1
|
||||||
one.txt: Deleted 1 extra copies
|
one.txt: Deleted 1 extra copies
|
||||||
two.txt: Found 3 files with duplicate names
|
two.txt: Found 3 files with duplicate names
|
||||||
|
@ -85,7 +86,8 @@ Now the `dedupe` session
|
||||||
s) Skip and do nothing
|
s) Skip and do nothing
|
||||||
k) Keep just one (choose which in next step)
|
k) Keep just one (choose which in next step)
|
||||||
r) Rename all to be different (by changing file.jpg to file-1.jpg)
|
r) Rename all to be different (by changing file.jpg to file-1.jpg)
|
||||||
s/k/r> r
|
q) Quit
|
||||||
|
s/k/r/q> r
|
||||||
two-1.txt: renamed from: two.txt
|
two-1.txt: renamed from: two.txt
|
||||||
two-2.txt: renamed from: two.txt
|
two-2.txt: renamed from: two.txt
|
||||||
two-3.txt: renamed from: two.txt
|
two-3.txt: renamed from: two.txt
|
||||||
|
|
|
@ -158,12 +158,13 @@ func dedupeList(ctx context.Context, f fs.Fs, ht hash.Type, remote string, objs
|
||||||
}
|
}
|
||||||
|
|
||||||
// dedupeInteractive interactively dedupes the slice of objects
|
// dedupeInteractive interactively dedupes the slice of objects
|
||||||
func dedupeInteractive(ctx context.Context, f fs.Fs, ht hash.Type, remote string, objs []fs.Object, byHash bool) {
|
func dedupeInteractive(ctx context.Context, f fs.Fs, ht hash.Type, remote string, objs []fs.Object, byHash bool) bool {
|
||||||
dedupeList(ctx, f, ht, remote, objs, byHash)
|
dedupeList(ctx, f, ht, remote, objs, byHash)
|
||||||
commands := []string{"sSkip and do nothing", "kKeep just one (choose which in next step)"}
|
commands := []string{"sSkip and do nothing", "kKeep just one (choose which in next step)"}
|
||||||
if !byHash {
|
if !byHash {
|
||||||
commands = append(commands, "rRename all to be different (by changing file.jpg to file-1.jpg)")
|
commands = append(commands, "rRename all to be different (by changing file.jpg to file-1.jpg)")
|
||||||
}
|
}
|
||||||
|
commands = append(commands, "qQuit")
|
||||||
switch config.Command(commands) {
|
switch config.Command(commands) {
|
||||||
case 's':
|
case 's':
|
||||||
case 'k':
|
case 'k':
|
||||||
|
@ -171,7 +172,10 @@ func dedupeInteractive(ctx context.Context, f fs.Fs, ht hash.Type, remote string
|
||||||
dedupeDeleteAllButOne(ctx, keep-1, remote, objs)
|
dedupeDeleteAllButOne(ctx, keep-1, remote, objs)
|
||||||
case 'r':
|
case 'r':
|
||||||
dedupeRename(ctx, f, remote, objs)
|
dedupeRename(ctx, f, remote, objs)
|
||||||
|
case 'q':
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeduplicateMode is how the dedupe command chooses what to do
|
// DeduplicateMode is how the dedupe command chooses what to do
|
||||||
|
@ -465,7 +469,9 @@ func Deduplicate(ctx context.Context, f fs.Fs, mode DeduplicateMode, byHash bool
|
||||||
}
|
}
|
||||||
switch mode {
|
switch mode {
|
||||||
case DeduplicateInteractive:
|
case DeduplicateInteractive:
|
||||||
dedupeInteractive(ctx, f, ht, remote, objs, byHash)
|
if !dedupeInteractive(ctx, f, ht, remote, objs, byHash) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
case DeduplicateFirst:
|
case DeduplicateFirst:
|
||||||
dedupeDeleteAllButOne(ctx, 0, remote, objs)
|
dedupeDeleteAllButOne(ctx, 0, remote, objs)
|
||||||
case DeduplicateNewest:
|
case DeduplicateNewest:
|
||||||
|
|
Loading…
Reference in a new issue