ComfyUI Node Runs on cloud

Zip Extract

Unpack a zip to a folder, then process each file

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Zip Extract
  • zip
  • paths
  • names
  • file_path
  • file_count
  • folder
  • report
pattern*
root
folderextracted
entry_pathskeep folders
existingoverwrite

Zip Extract is where an archive stops being a ZIP value on a wire and becomes actual files on disk - and, importantly, it hands you each written file so the rest of the graph can do something with it. This is the node that turns a dataset zip into a batch of loadable images, or pulls a model, a JSON sidecar, or a config out of a bundle. Files of any kind get written here, not just what this pack can load, which is what makes it the way to get non-image assets out of an archive.

The typical pattern: an archive of training images with captions arrives as one zip. Wire it from Open ZIP into Zip Extract, and instead of manually unzipping and hunting, you get paths straight into Load Image Batch, Load Text File or Path Exists. It's archive handling that stays inside the graph.

Inputs that matter

  • zip - the archive, from Open ZIP. One thing worth knowing: the file itself is read again here, so if the archive changed between Open ZIP and this node, the run stops rather than writing a mix of old and new.
  • pattern - which entries to write, as a glob. * takes everything readable, *.png takes every picture at any depth, frames/**/*.png anchors at the top and reaches any depth beneath it. Case is ignored.
  • root - where files land: ComfyUI's output or temp, or any folder you've added under paths.allow_write, listed by its own name. folder names the part below that root (tokens expand, so extracted/[time(%Y-%m-%d)] files each day's unpacking under its own dated folder).
  • entry_paths - what files are called on disk: keep folders rebuilds the archive's internal folders, file name only flattens them.
  • existing - the clash policy when the folder already holds a name: overwrite, skip (and name it in the report), or number apart (writes cat_2.png beside it).

Outputs, and the one that drives the loop

  • paths and names - every written file on one wire each (full paths, and the archive name each came from), in matching order, for the text-list nodes.
  • file_path - the same paths one per run. Wire this into Load Image Batch, Load Text File or Path Exists and the downstream graph runs once per written file. That's the batch driver. If nothing was written, nodes reading this output stop with a message while the rest keep working.
  • file_count - how many files landed.
  • folder - the full path of the folder written into, for Directory Listing or logging.
  • report - the whole thing as text (where files went, a line per file with size, a line per passed-over entry), for Save Text File.

Safety carries over from Open ZIP: anything Open ZIP refused is refused here too, so nothing lands outside the folder you chose. A clash between two entries that reach the same name inside a single run is always numbered apart - neither file is lost.

Install

It's in WAS Node Suite v3 - ComfyUI Manager, search "WAS Node Suite v3", or cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui, restart. Needs ComfyUI 0.14.0+ / Python 3.10+, no feature flag, no extra packages. Where people get tripped up: expecting paths and file_path to behave the same. paths is one wire holding a list - for inspecting and slicing. file_path is the one that fans out into per-file execution. Mix them up and your "process each file" loop silently becomes "process them as one list," which is a very different graph.

CategoryWAS Suite/Archive

Inputs (6)

NameTypeDefaultDescription
zipZIPThe opened archive to unpack, from Zip Open's archive output. The file itself is read again here, so an archive rewritten between the two nodes stops the run rather than writing a mixture.
patternSTRING*Which entries to write. `*` takes every readable entry, `*.png` every picture at any depth, and `frames/**/*.png` anchors at the top of the archive and reaches any depth under it. Case is ignored.
rootCOMBOWhich folder the entries are written into: ComfyUI's own 'output' or 'temp', or any folder added under paths.allow_write in config.yaml, listed by its own name. folder names the part below it.
folderSTRINGextractedFolder below the root the files land in, created if it is not there. Tokens expand, so 'extracted/[time(%Y-%m-%d)]' files each day's unpacking under its own dated folder. Empty writes into the root itself.
entry_pathsCOMBOkeep foldersWhat the files are called on disk. `keep folders` rebuilds the folders inside the archive, so 'frames/cat.png' becomes a 'frames' folder; `file name only` drops them and writes 'cat.png' straight into the chosen folder.
existingCOMBOoverwriteWhat happens where the folder already holds that name. `overwrite` replaces it, `skip` leaves it alone and names it in the report, and `number apart` writes 'cat_2.png' beside it.

Outputs (6)

NameTypeDescription
pathsARRAYEvery written file's full path on one wire, in name order, for Text List Get, Text List Slice and Text List Length. Entry 3 here is the path of name 3 in the 'names' output.
namesARRAYThe archive name each file came from, on one wire and in the same order, folders inside the archive included, so a file numbered apart on disk can still be traced to the entry it held.
file_pathSTRINGThe same paths one per run, so the nodes below run once for each file written: wire it into Load Image Batch, Load Text File or Path Exists. A run that wrote nothing stops the nodes reading this output with a message, and leaves the other four working.
file_countINTHow many files were written. Lower than the number the pattern picked where an entry was passed over, which the report names.
folderSTRINGThe full path of the folder the files were written into, tokens expanded and created if it was not there. Wire it into Directory Listing to read the folder back, or into Text to Console to record where a run put its files.
reportSTRINGThe report shown on the node, as text: where the files went, a line per file with its size, and a line per entry that was passed over. Wire it into Save Text File to keep a record of what an archive gave up.