geoprob_pipe.utils.file_system ============================== .. py:module:: geoprob_pipe.utils.file_system Classes ------- .. autoapisummary:: geoprob_pipe.utils.file_system.FileSystem Module Contents --------------- .. py:class:: FileSystem(path_folder, extension = None) FileSystem class which creates a convenient overview of a given folder and the files within it Initialize FileSystem instance which creates a convenient overview of a given folder and the files within it :param path_folder: path of folder for which a FileSystem instance will be created :type path_folder: str | Path :param extension: extension of specific files to include in the FileSystem instance. Defaults to None, which returns all files path_folder regardless of extension. :type extension: Optional[str], optional .. py:attribute:: folderpath .. py:attribute:: files .. py:method:: validate_path(path_to_check) :staticmethod: Checks if the given path exists :param path_to_check: path to either a file or a folder :type path_to_check: str | Path :raises FileNotFoundError: raised if the file/folder was not found :returns: Path object for the validated path :rtype: Path .. py:method:: find_files_in_dir(path_to_dir, extension = None) :staticmethod: Find all files with a specified extension in a folder and its subfolders. Note: files starting with ~$ are ignored since these are generally temporary files :param path_to_dir: folder to search in :type path_to_dir: str | Path :param extension: extension without the dot (e.g. "txt" instead of ".txt"). If None is passed all files in dir, regardless of extension, are returned :type extension: str, None :returns: list of paths to the found files in the dir. Returns None if no files were found. :rtype: list[Path] .. py:method:: find_subfolders(path_to_dir) :staticmethod: Find all subfolders within a parent folder :param path_to_dir: folder to search in :type path_to_dir: str | Path :returns: list of paths to the found subfolders in the dir. :rtype: list[Path]