summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-08-25 17:52:56 -0700
committerxyz <gky44px1999@gmail.com>2021-08-25 17:52:56 -0700
commit9be78e8cd9d28d979076885a0145f3d30080cdbb (patch)
tree80e08bb0d5ef443a9531c5eabb21c7b1065b04d5 /.local
parent306f66a4599fdf8a5eea6dfc41f9b25559eaf65a (diff)
mvtr, rename upper to lower, space to _
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/mvtr8
1 files changed, 8 insertions, 0 deletions
diff --git a/.local/bin/mvtr b/.local/bin/mvtr
new file mode 100755
index 00000000..574ccd9b
--- /dev/null
+++ b/.local/bin/mvtr
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# can use ls pipe to sed pipe to bash, similar to eval? see comment at link:
+# link also show perl-rename approach
+# https://linuxconfig.org/rename-all-files-from-uppercase-to-lowercase-characters
+# if only change ' ' to '_' `rename` might be sufficient, for upper to lower case might need perl-rename if want concise
+# shellcheck suggest use $1 for sh -c for better error messaging? see SC2156
+find "$@" -depth -execdir sh -c 'mv -nvT -- "$0" "$(echo "$0" | tr "[:upper:] " "[:lower:]_")"' '{}' \;