29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
import os
|
|
from pathlib import Path
|
|
from data.path_constant import DOWNLOAD_DIR, NETWORK_DIR
|
|
from helper.prerequisite import rename_episodes
|
|
|
|
# rename_episodes(DOWNLOAD_DIR)
|
|
# rename_episodes(NETWORK_DIR)
|
|
|
|
# for first_level_path in NETWORK_DIR.iterdir():
|
|
# if first_level_path.name == '怪力亂神':
|
|
# for second_level_path in first_level_path.iterdir():
|
|
# if "話." in second_level_path.name:
|
|
# episode_name = second_level_path.name.replace("話.", "話 ")
|
|
|
|
# new_path = first_level_path / episode_name
|
|
# print(second_level_path)
|
|
# print(new_path)
|
|
# os.rename(second_level_path, new_path)
|
|
|
|
download_dir = Path('C:/') / 'Users' / 'ithil' / 'Downloads'
|
|
download_dir = Path('E:/') / 'Webtoon' / 'PAYBACK' / '0.序章'
|
|
|
|
for image in download_dir.iterdir():
|
|
name = image.name
|
|
# new_name = str(int(name.split('.')[0]) - 10) + '.webp'
|
|
new_name = f"{(int(image.stem) -10):03d}{image.suffix}"
|
|
new_path = image.with_name(new_name) # 生成新路径
|
|
image.rename(new_path) # 重命名文件
|
|
print(f"重命名: {image.name} → {new_name}") |