Created
June 3, 2012 20:41
-
-
Save zeffii/2864967 to your computer and use it in GitHub Desktop.
print .blend filenames inside directory
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 bpy | |
import os | |
from os.path import join | |
def source_list(path, filename_check=None): | |
for dirpath, dirnames, filenames in os.walk(path): | |
# skip '.svn' | |
if dirpath.startswith("."): | |
continue | |
for filename in filenames: | |
filepath = join(dirpath, filename) | |
if filename_check is None or filename_check(filepath): | |
yield filepath | |
path_to_files = bpy.utils.script_paths()[0] | |
DIR = join(path_to_files, 'addons_contrib', 'io_material_loader') | |
source_files = [] | |
source_files.extend(source_list(DIR, filename_check=lambda f: f.endswith(".blend"))) | |
print("-"*40) | |
for i, filepath in enumerate(source_files): | |
# i want to print only the filename | |
file_name = filepath.split(os.sep)[-1] | |
print(file_name) | |
#print("TEST:", filepath, i, "of", len(source_files)) | |
#with bpy.data.libraries.load(filepath) as (data_from, data_to): | |
# if data_from.masks: | |
# print("FOUND:", filepath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment