[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: makeicecat fails for a miscalculation of the version of rename
From: |
Mark H Weaver |
Subject: |
Re: makeicecat fails for a miscalculation of the version of rename |
Date: |
Sat, 11 Feb 2023 21:48:54 -0500 |
Earlier, I wrote:
> Sorry for the delay. I think that the Perl Rename program does not
> provide enough value to warrant these complications. It seems to me
> that the same job could be done quite simply using find, awk and sh,
FYI, here's what I came up with to replace the Perl rename program,
using portable POSIX shell and sed:
--8<---------------cut here---------------start------------->8---
rename_files()
(
IFS=''
/bin/sed -e h -e 's|[^/]*$||' -e p \
-e g -e 's|.*/||' -e p "$@" |
while read -r dir && read -r old && read -r new; do
[ x"$old" = x"$new" ] || mv -- "$dir$old" "$dir$new"
done
)
--8<---------------cut here---------------end--------------->8---
It's smaller than the code previously used to check for the Perl rename
program. I've pushed it to the 'master' branch, here:
https://git.sv.gnu.org/cgit/gnuzilla.git/commit/?id=725be23ef0e1b484f9ae19c9c9cac1835c138a1b
If anyone sees a problem with this approach, please let me know.
Thanks!
Mark
- Re: makeicecat fails for a miscalculation of the version of rename,
Mark H Weaver <=