no need for python, just use a shell loop. in bash: for i in *.bmp; do convert $i ${i%.bmp}.gif ; done and there you go.