batch export blend files to gltf

Batch export Blender files to glTF

This script recursively finds every .blend file below a directory and exports each one as separate glTF files. It launches Blender in background mode for each model, so the batch can be run from a normal Python installation without opening the files manually.

File

batch_export_blend_files_to_gltf.py

Output layout

Each source file gets an export directory beside it. The glTF and binary data are placed there, while textures are kept in a nested textures directory.

models/
  character.blend
  export/
    character.gltf
    character.bin
    textures/
      base_color.png
      normal.png

Existing directories named export are excluded while searching, which prevents exported content from being treated as source material.

Usage

Place the script at the root of the Blender project tree and run it with a normal Python installation:

python batch_export_blend_files_to_gltf.py

To export a different directory:

python batch_export_blend_files_to_gltf.py --root path/to/models

Preview the work without launching Blender:

python batch_export_blend_files_to_gltf.py --dry-run

Show the Blender executables the script detected:

python batch_export_blend_files_to_gltf.py --list-blenders

Choose a particular Blender executable:

python batch_export_blend_files_to_gltf.py --blender "C:\Program Files\Blender Foundation\Blender 4.5\blender.exe"

How Blender is found

The script checks, in order:

When multiple discovered installations exist, newer versions are preferred. An explicit command-line path or environment variable remains the most direct way to select a version.

Export behavior

Notes


edit this page