mate_path_filters#
Provide friendly path filter API.
- class pathlib_mate.mate_path_filters.PathFilters[source]#
Provide friendly path filter API.
- select(filters=<function all_true>, recursive=True)[source]#
Select path by criterion.
- Parameters:
- Return type:
Iterable[Path]
中文文档
根据filters中定义的条件选择路径.
- select_file(filters=<function all_true>, recursive=True)[source]#
Select file path by criterion.
- Return type:
Iterable[Path]
中文文档
根据
filters
中定义的条件选择文件.
- select_dir(filters=<function all_true>, recursive=True)[source]#
Select dir path by criterion.
- Return type:
Iterable[Path]
中文文档
根据
filters
中定义的条件选择文件夹.
- property n_file#
Count how many files in this directory. Including file in sub folder.
- Return type:
- property n_dir#
Count how many folders in this directory. Including folder in sub folder.
- Return type:
- property n_subfile#
Count how many files in this directory (doesn’t include files in sub folders).
- Return type:
- property n_subdir#
Count how many folders in this directory (doesn’t include folder in sub folders).
- Return type:
- select_by_ext(ext, recursive=True)[source]#
Select file path by extension.
- Return type:
Iterable[Path]
中文文档
选择与预定义的若干个扩展名匹配的文件.
- select_by_pattern_in_fname(pattern, recursive=True, case_sensitive=False)[source]#
Select file path by text pattern in file name.
- Return type:
Iterable[Path]
中文文档
选择文件名中包含指定子字符串的文件.
- select_by_pattern_in_abspath(pattern, recursive=True, case_sensitive=False)[source]#
Select file path by text pattern in absolute path.
- Return type:
Iterable[Path]
中文文档
选择绝对路径中包含指定子字符串的文件.
- select_by_size(min_size=0, max_size=1099511627776, recursive=True)[source]#
Select file path by size.
- Return type:
Iterable[Path]
中文文档
选择所有文件大小在一定范围内的文件.
- select_by_mtime(min_time=0, max_time=4102444800.0, recursive=True)[source]#
Select file path by modify time.
- Parameters:
- Return type:
Iterable[Path]
中文文档
选择所有
pathlib_mate.pathlib2.Path.mtime
在一定范围内的文件.
- select_by_atime(min_time=0, max_time=4102444800.0, recursive=True)[source]#
Select file path by access time.
- Parameters:
- Return type:
Iterable[Path]
中文文档
选择所有
pathlib_mate.pathlib2.Path.atime
在一定范围内的文件.
- select_by_ctime(min_time=0, max_time=4102444800.0, recursive=True)[source]#
Select file path by create time.
- Parameters:
- Return type:
Iterable[Path]
中文文档
选择所有
pathlib_mate.pathlib2.Path.ctime
在一定范围内的文件.
- static sort_by_abspath(p_list, reverse=False)#
Sort list of
Path
by absolute path.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order
- static sort_by_fname(p_list, reverse=False)#
Sort list of
Path
by file name.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order
- static sort_by_ext(p_list, reverse=False)#
Sort list of
Path
by extension.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order
- static sort_by_size(p_list, reverse=False)#
Sort list of
Path
by file size.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order
- static sort_by_mtime(p_list, reverse=False)#
Sort list of
Path
by modify time.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order
- static sort_by_atime(p_list, reverse=False)#
Sort list of
Path
by access time.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order
- static sort_by_ctime(p_list, reverse=False)#
Sort list of
Path
by create time.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order
- static sort_by_md5(p_list, reverse=False)#
Sort list of
Path
by md5.- Params p_list:
list of
Path
- Params reverse:
if False, return in descending order