import os; import sys; filePathSrc="F:\\Workspace\\test\\"# Path to the folder with files to convert for root, dirs, files in os.walk(filePathSrc): for fn in files: if fn[-2:] == '.c'or fn[-2:] == '.h': # Specify type of the files notepad.open(root + "\\" + fn) notepad.runMenuCommand("Encoding", "Convert to UTF-8") # convent to utf-8 notepad.runMenuCommand("EOL Conversion", "Unix (LF)") # convent to unix LF notepad.save() notepad.close()