Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process_input_file 方法优化 #317

Open
baogeer opened this issue Dec 4, 2024 · 1 comment
Open

process_input_file 方法优化 #317

baogeer opened this issue Dec 4, 2024 · 1 comment

Comments

@baogeer
Copy link

baogeer commented Dec 4, 2024

def process_input_file(output_dir, root, file):
if not os.path.exists(f'{output_dir}'):
os.makedirs(f'{output_dir}', exist_ok=True)
src_path = f"{root}/{file}"
dst_path = f"{output_dir}/{file}"
if os.path.exists(f"{output_dir}/{file}"):
# 这里使用 Ctrl + C 停止程序会出bug, shutil.copy 会拷贝文件到一半停止
src_size = os.path.getsize(src_path)
dst_size = os.path.getsize(dst_path)
if src_size == dst_size:
return dst_path
shutil.copy(
src=src_path,
dst=dst_path
)
return dst_path

@Huanshere
Copy link
Owner

能否使用代码块打印出来呢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants