#! /usr/bin/python3 # MuseScore batch file conversion # GNU GENERAL PUBLIC LICENSE GPLv3 # !! Will overwrite any existing files with the target extension!!! import os mydir = os.getenv('HOME') + '/Desktop/capella' # <<<<< Change 'Desktop/capella' to the directory your files are in fromext = '.mscz' # <<<<< Change '.mscz' to the extension for format you want to convert from intoext = '.xml' # <<<<< Change '.xml' to the extension for format you want to convert to os.chdir(mydir) print ('---Starting---') for filename in os.listdir(mydir): if filename.endswith(fromext): newfile, dummy = os.path.splitext(filename) command = 'mscore '+filename+' -o '+newfile+intoext print (command) result = os.system(command) print ('---Finished---')