Just some random ideas on how to do this culled from elsewhere

Rename *.foo to *.bar:

ls -d *.foo | sed -e 's/.*/mv & &/' | sh