I have a good amount of files I have to rename. My files are called sample_1.wav sample_2.wav ...
I need to rename each one of them with a smaller number in the name, sample_1.wav
has to become sample_0.wav
and so on.
I have tried this script, but it does not maintain the order:
#!/bin/bash
count=0
for file in *.wav
do
new=$(printf "sample_%d.wav" "$count")
mv -- "$file" "$new"
(( count++ ))
done
Thank you for the help