I want to add a command line option -r, recurse, to this code:
for name in *.$1; do
stripped_name="$(basename "$name" ".$1")"
mv "$name.$1" "$name.$2"
done
So if I enter "change -r txt doc", the command should be executed recursively on any subfolder. For example, if there is a file aaa.txt and a directory y containing files y/bbb.txt and y/ccc.txt....it should result in files aaa.doc, y/bbb.doc and y/ccc.doc.
Also if I don't supply the "-r", it should work as normal.
Does anyone know how to add this to my script?