Last active
January 13, 2025 02:25
-
-
Save hucsmn/f76580d27207c8de3d80 to your computer and use it in GitHub Desktop.
批量转换日文zip解压产生的文件名乱码的 python3 脚本
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
# 批量转换日文zip解压产生的文件名乱码 | |
# 确保 python3 已安装,把乱码文件拖到这个脚本上即可 | |
import sys, os | |
for dir in sys.argv[1:]: | |
for root, dirs, files in os.walk(dir, topdown=False): | |
print("[%s]" % root) | |
for src in dirs+files: | |
dst = src.encode('mbcs').decode('shift_jisx0213') | |
print("%s -> %s" % (src, dst)) | |
os.rename(os.path.join(root, src), os.path.join(root, dst)) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment