def all_files(root): for x in Directory.GetFiles(root): yield Path.Combine(root, x) dirs = Directory.GetDirectories(root) for d in dirs: for x in all_files(d): yield x
def __getFolderItems(self, picturesOnly, count): if picturesOnly: list = [] else: def IsSpecialFolder(dir): d = Path.GetFileName(dir).lower() return d.startswith('_vti_') or d.startswith('app_') or d.startswith('bin') or d.startswith('aspnet_') list = [GetFolder(d) for d in Directory.GetDirectories(self.path)[:count] if not IsSpecialFolder(d)] count -= len(list) if count > 0: list += [GetPicture(p) for p in Directory.GetFiles(self.path, '*.jpg')[:count]] return list