get_filename

Contents

get_filename#

get_filename(file_path: str | CloudPath | Path, other_exts: list | str | None = None) str[source]#

Deprecated since version 1.30.0: Import it from sertit.path instead of sertit.files

Get file name (without extension) from file path, i.e.:

Parameters:
  • file_path (AnyPathStrType) – Absolute or relative file path (the file doesn’t need to exist)

  • other_exts (Union[list, str]) – Other double extensions to discard

Returns:

File name (without extension)

Return type:

str

Example

>>> file_path = 'D:/path/to/filename.zip'
>>> get_file_name(file_path)
'filename'