Blender artists, this script is supposed to copy fbx files from a subfolder A to another folder B, but it is doing the opposite. It is copying all the files instead of just fbx files. Here is the code, I need help please
import glob, sys
for root, dirs, files in os.walk(dir1):
for file in files:
First your last line, is not well indented. Meaning it’ll copy everything (as you said), but just print the filename if .FBX is encountered.
Dunno if uppercase and lowercase are treated correctly on “endswith” (look at the doc
Additionnaly, you declare dir1, dir2, but you used dir2 and dir3, that’s strange
the dir1 nd dir 2 are just placeholders, I actually mean the same thing. I tried changing FBX to fbx, same error happens.
Yes but the indentation of shutil.copy2 line make it out of the “IF file ends with fbx” scope. That’s the issue.
OMG, it was this little thing that
Thank you. It works!