config/shell/functions/lowercase: refine queries

This commit is contained in:
xeruf 2022-10-30 10:29:54 +01:00
parent 867f019928
commit 8f4fda1a1f
1 changed files with 4 additions and 4 deletions

View File

@ -462,10 +462,10 @@ else
alias f1='find -mindepth 1 -maxdepth 1'
fi
lowercase_transliterate="y/A-Z /a-z-/"
which perl-rename >/dev/null &&
alias lowercase="perl-rename -iv '$lowercase_transliterate'" ||
alias lowercase="rename -iv '$lowercase_transliterate'"
lowercase() {
#$(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' \;
}
# TODO replace cp by rsync, automatically use compression for remote transfers
# rsync directory properly - suffix both dirs with / to act on contents