OBJ to FBX convert in batch mode possible ?

Hallo everyone,

i am tying to batch process some (around 500) OBJ files into FBX is this possible with blender ?
Maybe with a python script ? I am a complete newbie to blender.

The OBJ files are generated with osm2world (http://osm2world.org/).
And i want to use the resulting FBX files in Unreal Engine 4 (UE4).

A direct OBJ to UE4 import causes the engine to crash every time.
But as FBX (in blender generated) it seems to work.

I don´t want to convert all files by hand so is there a batch way of doing this ?
best regards,
John

I made some researches and come up with a Python script, that does not work very well.
It saves the intro scene with the cube and i get the “Error: Object does not have duplis” error message.

here is the script:

import os
import bpy

#blender --background --python obj2fbx.py

full_path_to_directory = “/home/john/Desktop/Result/”
full_path_to_out_directory = “/home//john/Desktop/Result/fbx”
file_list = os.listdir(full_path_to_directory)
obj_list = [item for item in file_list if item[-3:] == ‘obj’]

bpy.ops.scene.delete()

for item in obj_list:
full_path_to_file = os.path.join(full_path_to_directory, item)

bpy.ops.scene.new(type='NEW')

bpy.ops.import_scene.obj(filepath=full_path_to_file,
             use_ngons=True,use_edges=True,
             use_smooth_groups=True,
             use_split_objects=True,
             use_split_groups=True,
             split_mode='ON',
             axis_forward='-Z',
             axis_up='Y',
             use_groups_as_vgroups=False,
             use_image_search=True,
             filter_glob="*.obj;*.mtl")

bpy.ops.export_scene.fbx(filepath=os.path.join(full_path_to_out_directory, item),
             batch_mode='SCENE',
             mesh_smooth_type='FACE',
             object_types={'MESH'},
             use_batch_own_dir=False,
             check_existing=True,
             filter_glob="*.fbx",
             use_selection=False,
             global_scale=1.0,
             axis_forward='-Z',
             axis_up='Y',
             use_mesh_modifiers=True,
             use_mesh_edges=False,
             use_anim=True,
             use_anim_action_all=True,
             use_default_take=True,
             use_anim_optimize=True,
             anim_optimize_precision=6.0,
             path_mode='AUTO',
             use_metadata=True)
bpy.ops.scene.delete()

Any ideas how i can improve this ?