Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import listdir, walk
- from os.path import join, isdir
- from opencc import OpenCC
- folderpath="D:\\Test"
- for namelists2 in walk(folderpath):
- for x in namelists2:
- NameAndPath=join(folderpath, str(x))
- if isdir(NameAndPath):
- with open('allfolders.txt',mode='a+', encoding='utf-8') as list:
- cc=OpenCC('s2t')
- y=cc.convert(x)
- list.write(("os.rename(\"")+join(folderpath, x)+("\", ")+("\"")+join(folderpath, y)+"\""+")"+"\n" )
- else:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement