Try:
find ./ -type d -execdir rename -v "s/^abcd124(.+)/abcd1234\1/" *.wav.gz ";"
Find already provides an iterator over your files - you don't need for
around it or xargs
behind, which is often seen. Good - in rare cases, they can be useful, but usually it is not.
It is useful to use -execdir here. Gnu-find has this; I do not know if your find.
But you need to make sure that you do not run the * .wav.gz file in the dir directory, because otherwise your shell will expand it and pass in extended names for renaming.
Note. I get a warning from renaming that I have to replace \ 1 with $ 1 in the regular expression, but if I do this, the pattern will not be found. I have to use \ 1 for it to work.
Here is another approach. Why search directories at all if we are looking for wav.gz files?
find . -name "*.wav.gz" -exec rename -v "s/^abcd124(.+)/abcd1234\1/" {} ";"
source share