code: def from_path_by_criterion(dir_path, criterion, keepboth=False):
          
          if keepboth:
              fc_yes, fc_no = FileCollection(), FileCollection()
              for winfile in FileCollection.yield_all_winfile(dir_path):
                  if criterion(winfile):
                      fc_yes.files.setdefault(winfile.abspath, winfile)
                  else:
                      fc_no.files.setdefault(winfile.abspath, winfile)
              return fc_yes, fc_no
          else:
              fc = FileCollection()
              for winfile in FileCollection.yield_all_winfile(dir_path):
                  if criterion(winfile):
                      fc.files.setdefault(winfile.abspath, winfile)
              return fc
docs: Create a new FileCollection, and select some files from ``dir_path``.
          
          How to construct your own criterion function::
          
              def filter_image(winfile):
                  if winfile.ext in [".jpg", ".png", ".bmp"]:
                      return True
                  else:
                      return False
          
              fc = FileCollection.from_path_by_criterion(dir_path, filter_image)
          
          :param dir_path: path of a directory
          :type dir_path: string
          :param criterion: customize filter function
          :type criterion: function
          :param keepboth: if True, returns two file collections, one is files
              with criterion=True, another is False.
          :type keepboth: boolean
          
          **中文文档**
          
          直接选取dir_path目录下所有文件, 根据criterion中的规则, 生成
          FileCollection。