Skip to content

Instantly share code, notes, and snippets.

@ailinykh
Created March 16, 2019 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ailinykh/dbcd18e783666852cc467e3714355015 to your computer and use it in GitHub Desktop.
Save ailinykh/dbcd18e783666852cc467e3714355015 to your computer and use it in GitHub Desktop.
Python file renaming
from os import walk, path, rename
import re
def main():
for (_, _, filenames) in walk('.'):
for file in filenames:
if file.endswith('.png'):
name = re.sub('\-Arb', '_RTL', file)
rename(file, name)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment