From 10de418b6e033ed51b35b45ffb0af959c33d442e Mon Sep 17 00:00:00 2001 From: milarin Date: Wed, 14 Jun 2023 14:46:57 +0200 Subject: [PATCH] changed bulkrename script to work work with filenames containing single quotation marks --- README.md | 2 +- main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c818b4e..8d537c1 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,7 @@ Content: #!/usr/bin/env sh if [ "$3" = "exec" ]; then - command ls | format -i "$1" -o "mv \"{0}\" \"$2\"" | xargs -0 -P 4 sh -c + command ls | format -0 -i "$1" -o "mv \"{0}\" \"$2\"" | xargs -0 -P 4 -I {} sh -c "{}" else command ls | format -i "$1" -o "mv \"{0}\" \"$2\"" echo diff --git a/main.go b/main.go index 9a6dc01..d76d9c5 100644 --- a/main.go +++ b/main.go @@ -140,7 +140,7 @@ func ReadLine(r *bufio.Reader) (string, error) { } func replaceVars(format string, vars ...string) string { - replacements := replacePattern.FindAllStringSubmatch(format, -1) + replacements := replacePattern.FindAllStringSubmatch(format, -1) // TODO arguments do not change in outer loop (can be moved to main method) for _, replacement := range replacements { rplStr := replacement[0]