# -*- coding: utf-8 -*- """comfyui_drive_link.ipynb Automatically generated by Colab. Original file is located at https://colab.research.google.com/#fileId=https%3A//huggingface.co/arcacolab/drive_link/blob/main/comfyui_drive_link.ipynb Open In Colab """ import os source_checkpoints = "/content/ComfyUI/models/checkpoints" target_checkpoints = "/content/drive/MyDrive/ONECLICK/model" source_loras = "/content/ComfyUI/models/loras" target_loras = "/content/drive/MyDrive/ONECLICK/lora" source_vae = "/content/ComfyUI/models/vae" target_vae = "/content/drive/MyDrive/ONECLICK/vae" source_embeddings = "/content/ComfyUI/models/embeddings" target_embeddings = "/content/drive/MyDrive/ONECLICK/embedding" os.makedirs(target_checkpoints, exist_ok=True) os.makedirs(target_loras, exist_ok=True) os.makedirs(target_vae, exist_ok=True) os.makedirs(target_embeddings, exist_ok=True) !ln -sf "{target_checkpoints}" "{source_checkpoints}" !ln -sf "{target_loras}" "{source_loras}" !ln -sf "{target_vae}" "{source_vae}" !ln -sf "{target_embeddings}" "{source_embeddings}" #출력물 경로 관련 import shutil def delete_output_folder_if_file_exists(): """ /content/ComfyUI/output 폴더 내부에 _output_images_will_be_put_here 파일이 있는 경우 폴더를 삭제합니다. 파일이 없는 경우 폴더를 유지합니다. """ folder_path = "/content/ComfyUI/output" file_path = os.path.join(folder_path, "_output_images_will_be_put_here") if os.path.exists(file_path): shutil.rmtree(folder_path, ignore_errors=True) print(f"{folder_path} 폴더를 삭제했습니다. (_output_images_will_be_put_here 파일이 존재합니다.)") else: print(f"{folder_path} 폴더를 유지합니다. (_output_images_will_be_put_here 파일이 존재하지 않습니다.)") # 함수 호출 delete_output_folder_if_file_exists() import os sdpath = "/content/drive/MyDrive/ONECLICK/" outputspath = sdpath + "output" if not os.path.exists(outputspath): !mkdir -p -v "{outputspath}" link_path = "/content/ComfyUI/output" if not os.path.exists(link_path) and not os.path.islink(link_path): !ln -s -v "{outputspath}" "{link_path}"