fluentfs.filelike.dir.Dir

class fluentfs.filelike.dir.Dir(path: str, expand_user: bool = True, expand_vars: bool = True)

Bases: FileLike

__init__(path: str, expand_user: bool = True, expand_vars: bool = True) None

Methods

__init__(path[, expand_user, expand_vars])

dir(subdir_name)

The directory with the given name located in this directory.

file(file_name)

The file with the given name located in this directory.

Attributes

dirs

An iterator of all directories present in this directory and all subdirectories.

file_likes

An iterator of file-like objects present in this directory and all subdirectories.

files

An iterator of (regular) files present in this directory and all subdirectories.

name

path

The maximally expanded path of the file-like object.

relative_path

relpath

dir(subdir_name: str) Dir

The directory with the given name located in this directory.

Parameters:

subdir_name – The name of the directory.

Returns:

A Dir object representing the given directory.

property dirs: FunctionalIterator[Dir]

An iterator of all directories present in this directory and all subdirectories.

Returns:

The iterator.

file(file_name: str) File

The file with the given name located in this directory.

Parameters:

file_name – The file name.

Returns:

A File object representing the given file.

property file_likes: FunctionalIterator[FileLike]

An iterator of file-like objects present in this directory and all subdirectories.

Returns:

The iterator.

property files: FileIterator

An iterator of (regular) files present in this directory and all subdirectories.

Returns:

The iterator.

property path: str

The maximally expanded path of the file-like object.