FileBase
- class csvio.filebase.FileBase(filename: str)
Bases:
object
This is a base class representing a basic file.
- Parameters
filename (required) – Full path to a file.
- delete(missing_ok: bool = False) bool
Delete the file at the path provided in the filename parameter
- Parameters
missing_ok (optional) – Parameter to pass to the
pathlib.Path.unlink()
method.- Returns
True
If file is deleted successfully.False
On failure.
- property file_ext: str
- Returns
Extension suffix of the file without parent directory and file name.
- property filedir: str
- Returns
Parent directory path of the file (excluding the name of the file)
- property filename: str
- Returns
File name without the parent directory path.
- property filename_no_ext: str
- Returns
File name without parent directory and file extension.
- property filepath: str
- Returns
Complete file path including the parent directory, file name and extension
- property path_obj: pathlib.Path
- Returns
pathlib.Path
object representing filename.
- touch(exist_ok: bool = False) bool
Create a blank file at the path provided in the filename parameter.
- Parameters
exist_ok (optional) – Parameter to pass to the
pathlib.Path.touch()
method.- Returns
True
If blank file is created successfully.False
On failure.