From 706c7ece35e450b1b19b960b6e72a5a96c3aad16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Mon, 25 Jul 2022 12:14:51 +0800 Subject: [PATCH] add -s option --- README.md | 5 ++++- main.go | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aedc64d..d47b172 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,13 @@ Detect duplicated images and gather each group into a unique subfolder. ## usage ```powershell -Usage: dupimage [-adht] ext1 ext2... +Usage: dupimage [-adhst] ext1 ext2... -a action sort -d string work directory (default "./") + -h display help + -s uint + folder sequence number start (exclude) -t uint duplicate throttle, max is 64 (default 5) exts matching extensions diff --git a/main.go b/main.go index fa0ed7e..331278a 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,7 @@ func main() { dir := flag.String("d", "./", "work directory") a := flag.Bool("a", false, "action sort") h := flag.Bool("h", false, "display help") + s := flag.Uint("s", 0, "folder sequence number start (exclude)") flag.Parse() if *h { fmt.Println("Usage:", os.Args[0], "[-adht] ext1 ext2...") @@ -144,13 +145,13 @@ func main() { } } if hasfound { - j := 0 + j := *s for _, lst := range dups { if len(lst) > 0 { j++ fmt.Println("[", j, "] duplicate:", lst) if action { - newdir := strconv.Itoa(j) + newdir := strconv.FormatUint(uint64(j), 10) err = os.MkdirAll(newdir, 0755) if err != nil { fmt.Println("ERROR:", err)