Blender Artists, I have a Main folder “ADAM”. ADAM contains two subfolders “A” and “B”. Subfolders A and B have different files in them also.
I am trying to write a script in blender that will
- identify the first subfolder in main folder ADAM
- copy all glb files in first subfolder to subfolder B
Here is my current code, but it only copies glb files from Main folder ADAM, not the first subfolder (what I want). I need help please
import bpy
import os
import shutil
SOURCE_DIR = 'C:/Users/ME/Desktop/Adam/'
DEST_DIR = 'C:/Users/ME/Desktop/Adam/B/'
def copy_glb_first_folder(SOURCE_DIR):
folders = os.listdir(SOURCE_DIR)
folder = folders[0]
copy_glb_first_folder(SOURCE_DIR)
for root, dirs, files in os.walk(SOURCE_DIR):
for name in files:
for fname in os.listdir(SOURCE_DIR):
if fname.lower().endswith('.glb'):
shutil.copy(os.path.join(SOURCE_DIR, fname), DEST_DIR)`Preformatted text`