diff options
author | xyz <gky44px1999@gmail.com> | 2021-10-05 21:37:41 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2021-10-05 21:37:41 -0700 |
commit | 18ab2192de9940bc057d69b527ba288e21b33b69 (patch) | |
tree | bbbb58d4de2b012c9fdcadae6017fe9a339a64c4 | |
parent | d48212d1ac503ad42ca403400c399efeb9f76a39 (diff) |
refactor
-rwxr-xr-x | .local/bin/mvtr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/.local/bin/mvtr b/.local/bin/mvtr index a4fa90a0..38fc5071 100755 --- a/.local/bin/mvtr +++ b/.local/bin/mvtr @@ -8,7 +8,7 @@ # pass awk script as argument trick from url: # https://unix.stackexchange.com/questions/282503/right-syntax-for-awk-usage-in-combination-with-other-command-inside-xargs-sh-c # -exec can't replace -execdir here, see cli notes for the -exec way -find "$@" -depth -execdir sh -c 'mv -nvT -- "$2" "$(echo "$2" | awk "$1" )"' shell '{gsub(/\/-+/,"/");gsub(/ +/,"_");gsub(/_*-+_*/,"-");print tolower($0)}' '{}' \; +find "$@" -depth -execdir sh -c 'mv -nvT -- "$2" "$(echo "$2" | awk "$1" )"' shell '{sub(/\/-+/,"/");gsub(/ +/,"_");gsub(/_*-+_*/,"-");print tolower($0)}' '{}' \; # for test #mkdir -p ~/test/TE\ ST/; rm -rf ~/test/TE\ ST/1t/; cp -r ~/test/0t/ ~/test/TE\ ST/1t/; mvtr ~/test/TE\ ST/1t/; tree ~/test/TE\ ST/1t/ |