init
This commit is contained in:
25
NeedTranslate/rename.py
Normal file
25
NeedTranslate/rename.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
ch4F = "./ch4"
|
||||
files = os.listdir(ch4F)
|
||||
|
||||
os.mkdir(f"{ch4F}/TEMPwo0")
|
||||
|
||||
for sprite in files:
|
||||
if ".png" in sprite and sprite and f"{sprite[:-6]}_1.png" in files:
|
||||
if "TEMP" not in files:
|
||||
os.mkdir(f"{ch4F}/TEMP")
|
||||
for finds in files:
|
||||
if sprite[:-6] in finds and sprite in files:
|
||||
shutil.move(f"{ch4F}/{finds}", f"{ch4F}/TEMP/{finds}")
|
||||
os.rename(f"{ch4F}/TEMP", f"{ch4F}/{sprite[:-6]}")
|
||||
else:
|
||||
shutil.move(f"{ch4F}/{sprite}", f"{ch4F}/TEMPwo0/{sprite}")
|
||||
os.rename(f"{ch4F}/TEMPwo0/{sprite}", f"{ch4F}/TEMPwo0/{sprite[:-6]}.png")
|
||||
files = os.listdir(ch4F)
|
||||
|
||||
shutil.move(f"{ch4F}/TEMPwo0", f"{ch4F}")
|
||||
os.remove(f"{ch4F}/TEMPwo0")
|
||||
|
||||
print(files)
|
||||
Reference in New Issue
Block a user