API Guide
Model Class
- class pathutility.pathutils.PathUtils
A utility class for handling path-related operations.
- Attributes:
properties (dict): A dictionary containing properties retrieved based on the provided parameters.
- static create_directory_if_not_exists(path)
Create a directory if it doesn’t exist.
- Args:
path (str): The path to the directory to be created.
- static get_file_access_time(path)
Get the last access time of a file.
- Args:
path (str): The path to the file.
- Returns:
float: The last access time of the file.
- static get_file_creation_time(path)
Get the creation time of a file.
- Args:
path (str): The path to the file.
- Returns:
float: The creation time of the file.
- static get_file_encoding(path)
Detect file encoding.
- Args:
path (str): The path to the file.
- Returns:
str or None: The detected encoding or None if an error occurs.
- static get_file_extension(path)
Get the file extension from a path.
- Args:
path (str): The path from which to extract the extension.
- Returns:
str: The file extension.
- static get_file_modification_time(path)
Get the last modification time of a file.
- Args:
path (str): The path to the file.
- Returns:
float: The last modification time of the file.
- static get_file_size(path)
Get the size of a file in bytes.
- Args:
path (str): The path to the file.
- Returns:
int: The size of the file in bytes.
- static get_filename(path)
Get the filename from a path.
- Args:
path (str): The path from which to extract the filename.
- Returns:
str: The filename.
- static get_filename_without_extension(path)
Get the filename without its extension from a path.
- Args:
path (str): The path from which to extract the filename.
- Returns:
str: The filename without extension.
- static get_parent_directory(path)
Get the parent directory of a given path.
- Args:
path (str): The path from which to get the parent directory.
- Returns:
str: The parent directory path.
- static is_file_exists(path)
Check if a file exists.
- Args:
path (str): The path to the file.
- Returns:
bool: True if the file exists, False otherwise.
- static list_files_in_directory(directory)
List all files in a directory.
- Args:
directory (str): The path to the directory.
- Returns:
list: A list of filenames in the directory.