get_filename#

get_filename(file_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], other_exts: Optional[Union[list, str]] = None) str[source]#

Get file name (without extension) from file path, ie:

>>> file_path = 'D:/path/to/filename.zip'
>>> get_file_name(file_path)
'filename'
Parameters
  • file_path (Union[str, CloudPath, Path]) – 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