dotfiles/.local/bin/scripts/sedrename

6 lines
188 B
Plaintext
Raw Normal View History

2023-09-22 04:21:13 +00:00
#!/bin/sh -x
# Rename files according to a given extended regex sed expression
sedexpr="$1"
shift
2023-11-04 18:08:39 +00:00
find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | sed -E "'"$sedexpr"'")" 2>/dev/null' \;