code: def next(self):
          
          # get depth of starting root directory
          base_depth = self.__root.count(os.path.sep)
  
          # walk files and folders
          for root, subFolders, files in os.walk(self.__root):
  
              # apply folder filter
              if not self.filter_folder(root):
                  continue
  
              # make sure we don't pass depth limit
              if self.__depth_limit is not None:
                  curr_depth = root.count(os.path.sep)
                  if curr_depth - base_depth > self.__depth_limit:
                      continue
  
              # if need to return folders return it
              if self.__ret_folders:
                  yield root
  
              # return files
              if self.__ret_files:
                  for f in files:
                      yield os.path.join(root, f)
  
          # end iterator
          raise StopIteration
docs: Return all files in folder.