Created
March 21, 2023 07:14
-
-
Save CGArtPython/0c0ab7f777ef74b1d8e5364f965cd3e9 to your computer and use it in GitHub Desktop.
[Blender Python Scripting] Get a list of blend file in the same folder as the Python script file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import pprint | |
path_to_current_dir = pathlib.Path(__file__).parent | |
########### | |
# Option 1 | |
########### | |
blend_files = list() | |
for blend_file in path_to_current_dir.glob("*.blend"): | |
blend_files.append(str(blend_file)) | |
########### | |
# Option 2 | |
########### | |
# you can also create a list in one line like this | |
# blend_files = [str(blend_file) for blend_file in path_to_current_dir.glob("*.blend")] | |
pprint.pprint(blend_files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment