A simple ComfyUI custom node that copies model files from the models/ folder to the output/ folder.
Daïm Al-Yad (@daimalyad)
MIT License
- Copy the
ModelCopyNodefolder to your ComfyUIcustom_nodes/directory - Restart ComfyUI
- The node will appear in the node menu under the "file_operations" category
- file_path (STRING): The relative path to the file within the models folder
- Example:
checkpoint/model.safetensors - Example:
loras/my_lora.safetensors - Example:
embeddings/textual_inversion.pt
- Example:
- success (BOOLEAN): Whether the copy operation was successful
- output_path (STRING): The full path where the file was copied to
- error_message (STRING): Error message if the copy failed (empty string if successful)
- Add the "Model Copy Node" to your workflow
- Connect a text input or use the text field directly
- Enter the relative path to your file (e.g.,
checkpoint/model.safetensors) - Execute the workflow
- Check the outputs to verify success
- Automatically creates output directories if they don't exist
- Preserves file metadata using
shutil.copy2 - Comprehensive error handling and validation
- Only copies the file name to the output folder (not the full directory structure)
- Safe file operations with proper path validation
- The node expects a
models/folder in your ComfyUI root directory - Files are copied to the
output/folder in your ComfyUI root directory - Only the filename is preserved in the output folder (not the subdirectory structure)
- The node will create any necessary subdirectories in the output folder
The node handles various error conditions:
- Empty or invalid file paths
- Source file not found
- Permission errors
- OS-level errors
- General exceptions
All errors are returned as descriptive messages in the error_message output.