import glob import subprocess for file in glob.glob("*.png"): file_ext=file.split(".")[0] print ("Converting "+file_ext) subprocess.Popen(["convert",file,file_ext+".xpm"])