folder_extract_parallel module
- folder_extract_parallel.get_file_info(file_path)[source]
Function to get file information.
- Args:
file_path (str): The path to the file.
- Returns:
tuple: A tuple containing the file path, size, creation time, and modification time.
- folder_extract_parallel.main(folder_path, db_path, worker)[source]
Main function to coordinate the processing of files and saving to the database using multiple threads.
- Args:
folder_path (str): The path to the folder to process. db_path (str): The path to the SQLite database file. worker (int): The number of worker threads to use.
This function sets up a queue and starts a thread pool to process files and save their information to the database.
- folder_extract_parallel.process_folder(folder_path, file_queue)[source]
Function to process files in a folder and put their information into a queue.
- Args:
folder_path (str): The path to the folder to process. file_queue (queue.Queue): The queue to put file information into.
This function walks through the folder and its subdirectories, gets the information for each file using get_file_info, and puts the information into the queue using a thread pool.
- folder_extract_parallel.save_to_database(file_queue, db_path)[source]
Function to save file information from the queue to a SQLite database.
- Args:
file_queue (queue.Queue): The queue to get file information from. db_path (str): The path to the SQLite database file.
This function creates a SQLite database table if it does not exist, and continuously gets file information from the queue and inserts it into the database until a sentinel value (None) is encountered.