This small script will convert your .obj models to blender scene files (.blend)
First of all create two folders
./obj and ./blend then open terminal / cmd
and write -> cd /path/to/work/folder
then -> path/to/blend_exe --background --python obj2blend.py
Be sure sure that you put the .obj files in the .obj folder
#!/usr/bin/python3
import os
import bpy
#run using: blender.exe --background --python main.py
for paths, dirs, files in os.walk("./obj/"):
for file in files:
# new blend
bpy.ops.wm.read_homefile()
# import obj
path = os.path.join(paths, file)
print("importing:", path)
bpy.ops.import_scene.obj(filepath=path, global_clamp_size=10*3, axis_up = "Z", axis_forward="Y")
# save blend
blend_name = file.replace(".obj", ".blend") if str(file).endswith(".obj") else "%s.blend" % file
bpy.ops.wm.save_mainfile(filepath=os.path.join("./blend", blend_name), )