mirror of
https://github.com/itchyny/mmv.git
synced 2025-12-26 22:24:58 +08:00
list all the sources to skip the cleaned sources
This commit is contained in:
parent
8dca62c00c
commit
e306b90e00
1 changed files with 7 additions and 2 deletions
9
mmv.go
9
mmv.go
|
|
@ -41,9 +41,13 @@ func (err *sameDestinationError) Error() string {
|
|||
|
||||
func buildRenames(files map[string]string) ([]rename, error) {
|
||||
rs := make([]rename, 0, 2*len(files))
|
||||
vs := make(map[string]int, len(files))
|
||||
revs := make(map[string]string, len(files))
|
||||
for src, dst := range files {
|
||||
srcs := make([]string, 0, len(files))
|
||||
for src := range files {
|
||||
srcs = append(srcs, src)
|
||||
}
|
||||
for _, src := range srcs {
|
||||
dst := files[src]
|
||||
if src == "" || dst == "" {
|
||||
return nil, &emptyPathError{}
|
||||
}
|
||||
|
|
@ -68,6 +72,7 @@ func buildRenames(files map[string]string) ([]rename, error) {
|
|||
}
|
||||
}
|
||||
var i int
|
||||
vs := make(map[string]int, len(files))
|
||||
for _, dst := range files {
|
||||
if vs[dst] > 0 {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue