bin: refactor lowercase script
This commit is contained in:
parent
905b43b5d4
commit
bac21d5b60
|
@ -2,4 +2,5 @@
|
||||||
# Lowercase given files
|
# Lowercase given files
|
||||||
#perl-rename 'y/A-Z /a-z-/' "$@"
|
#perl-rename 'y/A-Z /a-z-/' "$@"
|
||||||
#$(which perl-rename || echo rename) -iv 'y/A-Z /a-z-/' "$@"
|
#$(which perl-rename || echo rename) -iv 'y/A-Z /a-z-/' "$@"
|
||||||
find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | tr "A-Z " "a-z-" | sed "s|---|_|;s|\.-|.|")" 2>/dev/null' \;
|
sedrename "s| |-|;s|---|_|;s|\.-|.|;s|.*|\L\0|g" "$@"
|
||||||
|
# find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | tr "A-Z " "a-z-" | sed "s|---|_|;s|\.-|.|")" 2>/dev/null' \;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh -x
|
||||||
|
# Rename files according to a given extended regex sed expression
|
||||||
|
sedexpr="$1"
|
||||||
|
shift
|
||||||
|
find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | sed -E "'$sedexpr'")" 2>/dev/null' \;
|
Loading…
Reference in New Issue