summaryrefslogtreecommitdiff
path: root/.local/bin/mvtr
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/mvtr')
-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:]_")"' '{}' \;