CPP-TOOLBOX
Loading...
Searching...
No Matches
fs_utils.main Namespace Reference

Functions

 concatenate_files (source_files, destination_file)
 
List[str] find_all_instances_of_file_in_directory_recursively (base_directory, target_filename)
 
None process_files_recursively (str directory, List[str] filetypes, Callable[[str], None] file_function)
 
str get_absolute_path_of_where_this_script_exists ()
 
Optional[str] recursively_find_directory (str search_dir, str dir_to_find)
 
bool attempt_to_delete_files (List[str] file_paths)
 
bool attempt_to_delete_file (str file_path)
 

Function Documentation

◆ attempt_to_delete_file()

bool fs_utils.main.attempt_to_delete_file ( str file_path)

◆ attempt_to_delete_files()

bool fs_utils.main.attempt_to_delete_files ( List[str] file_paths)

◆ concatenate_files()

fs_utils.main.concatenate_files ( source_files,
destination_file )
Concatenates the contents of source files into a destination file.

Parameters:
    source_files (List[str]): List of paths to source files.
    destination_file (str): Path to the destination file (overwritten if exists).

◆ find_all_instances_of_file_in_directory_recursively()

List[str] fs_utils.main.find_all_instances_of_file_in_directory_recursively ( base_directory,
target_filename )
Recursively searches for all instances of a file with the given name in the specified directory.

Parameters:
    base_directory (str): The root directory to start the search.
    target_filename (str): The name of the file to search for.

Returns:
    List[str]: A list of full paths to each matching file.

◆ get_absolute_path_of_where_this_script_exists()

str fs_utils.main.get_absolute_path_of_where_this_script_exists ( )
returns the path to the script in which this function was called.

◆ process_files_recursively()

None fs_utils.main.process_files_recursively ( str directory,
List[str] filetypes,
Callable[[str], None] file_function )
Iterates over all files in a directory recursively, filters by a list of filetypes,
and applies a function to each file.

Args:
    directory (str): The directory to search in.
    filetypes (List[str]): A list of file extensions to filter (e.g., ['.txt', '.py']).
    file_function (Callable[[str], None]): A function to run with the path to each file.

◆ recursively_find_directory()

Optional[str] fs_utils.main.recursively_find_directory ( str search_dir,
str dir_to_find )