Hi!
i want to run my script on all the file in a folder, i make a bat file but i know how to run the file by writing them one by one, here is my example:
Example code imports all objs with the given name from current dir and all its subdirs. To use, change to respective dir and start Blender from there via command line. This code runs as is, just adapt it to your needs.
import os
import bpy
File = "model.2.obj"
for root, dirs, files in os.walk('.'):
for file in files: # loops through directories and files
if file == File: # compares to specified condition
#pot = os.getcwd()
pot2 = os.path.join(root,file)
print("Pot2 = ", pot2)
imported_object = bpy.ops.import_scene.obj(filepath=pot2)
for x in bpy.data.textures: x.extension = 'EXTEND'
print ("File exists", files)