ComfyUI Node

Media Organizer

The tiny node that sorts your Instagram downloads into images and videos

By rohitsainier·Created 2 years ago·Updated 2 years ago· 22
Media Organizer
    • images_path
    • videos_path
    • image_count
    • video_count
    input_path

    Media Organizer is the tidy-up half of the ComfyUI-InstagramDownloader pack. It takes a directory path, sweeps the loose files into images/ and videos/ subfolders, and tells you how many of each it moved. That's the whole job - no scraping, no network calls, nothing clever. It's the node you reach for right after Instagram Downloader has dumped an entire profile into one flat folder.

    That flat folder is genuinely annoying, by the way. instaloader writes pictures and videos side by side with caption .txt files and the profile's avatar, so a downloaded profile is chaos until something sorts it. Media Organizer is that something.

    How it works

    It lists everything in the folder you point it at and shutil.move()s each file based on its extension: .jpg and .png into images/, .mp4 into videos/. Both subfolders get created if they don't exist, then you get back the paths and the counts. The nice part for LoRA training and dataset work: a clean images/ folder is exactly what you hand to a captioning pass or a trainer, and the "dataset curation beats every knob" rule from the training literature starts with getting files out of a pile.

    It's also not married to Instagram. Point it at any directory full of media - downloaded reference sets, a folder you copied over, whatever - and it does the same sort. It works standalone.

    The inputs and outputs

    One input, one that you actually care about:

    • input_path - a STRING directory path. Wire in the download_path output from the Instagram Downloader node, or type an absolute path. Default is empty, so you do have to fill it in.

    The four outputs:

    • images_path and videos_path - the STRING paths to the sorted folders. Wire images_path into a Load Image (or a batch loader) to feed your reference set into the graph.
    • image_count and video_count - INTs saying how many files landed in each. These are mostly for you to glance at in the node title and confirm the download actually pulled something, though you could wire them into a conditional if you're feeling ambitious.

    Where it gets you

    Because it only recognizes those three extensions, whatever instaloader wrote that isn't .jpg, .png, or .mp4 gets left in the root folder. That means caption .txt files and .json.xz metadata sidecars just sit there, and any .webp or .heic images get ignored entirely. It's a minor annoyance for most Instagram content - that platform serves JPGs and MP4s for the most part - but don't expect a perfect empty directory at the end.

    The other gotcha is that shutil.move() won't cross filesystem boundaries, so the input path and the folder you're moving within need to live on the same drive. That's usually the case since it's all under ComfyUI's output folder anyway, but worth knowing if you point it at a mounted drive.

    Installing it

    Same pack, same install as the downloader: ComfyUI Manager, search "Instagram Downloader", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rohitsainier/ComfyUI-InstagramDownloader
    cd ComfyUI-InstagramDownloader
    pip install -r requirements.txt
    

    Then restart ComfyUI. The only dependency is instaloader (needed by the sibling node even if you only use this one), and there are no models to fetch. It's a small pack by a single author, so set expectations accordingly - but for sorting a downloaded profile into a usable dataset folder, it's the right tool and it's free.

    Categoryinstagram

    Inputs (1)

    NameTypeDefaultDescription
    input_pathSTRING

    Outputs (4)

    NameTypeDescription
    images_pathSTRING
    videos_pathSTRING
    image_countINT
    video_countINT