Skip to content

Instantly share code, notes, and snippets.

@Gus-The-Forklift-Driver
Last active February 25, 2023 13:00
Show Gist options
  • Save Gus-The-Forklift-Driver/6bb0bb259f9fdc060b3be9f9fb342319 to your computer and use it in GitHub Desktop.
Save Gus-The-Forklift-Driver/6bb0bb259f9fdc060b3be9f9fb342319 to your computer and use it in GitHub Desktop.
craw within folder to load all files matching the regex
import os
import re
import bpy
root = './'
def use_regex(input_text):
pattern = re.compile(r".+_LOD5\.fbx", re.IGNORECASE)
return bool(pattern.match(input_text))
print('==========STARTING=========')
for root, dirs, files in os.walk(root):
for file in files:
print(f'file : {root}/{file}')
if use_regex(file) == True:
bpy.ops.import_scene.fbx(filepath=root+'/'+file)
print(f'importing.')
print('==========DONE==========')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment