Created
May 31, 2018 18:49
-
-
Save jontey/93dce03ce39f49ade3de53e8885085b9 to your computer and use it in GitHub Desktop.
Convert files with selected extensions to UTF-8 using Notepad++ and Python Script plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os; | |
import sys; | |
filePathSrc = notepad.prompt('Enter the path to the folder where the files are located', 'Convert files to UTF-8', 'C:\\'); | |
for root, dirs, files in os.walk(filePathSrc): | |
for fn in files: | |
if fn[-3:] == '.js' or fn[-4:] == '.php' or fn[-4:] == '.htm' or fn[-5:] == '.html' or fn[-4:] == '.css' or fn[-4:] == '.txt': | |
notepad.open(root + "\\" + fn) | |
console.write(root + "\\" + fn + "\r\n") | |
notepad.runMenuCommand("Encoding", "Convert to UTF-8") | |
notepad.save() | |
notepad.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment