Unzip File to Folder
Description
The unzip_file
function extracts the contents of a zip file to a specified folder.
Function Signature:
def unzip_file(zip_file_path: str, output_folder_path: str) -> None:
Parameters
- zip_file_path (str): Full path to the zip file that you want to extract.
- output_folder_path (str): Full path to the folder where the zip contents will be extracted.
Returns
- None: The function does not return any value.
Example Usage
unzip_file("/path/to/archive.zip", "/path/to/extracted_folder")
Notes
- The function checks if the zip file exists. If not, it raises a
FileNotFoundError
. - If the output folder does not exist, it will be created automatically.
- All contents of the zip file are extracted into the specified output folder.
Error Handling
- FileNotFoundError: Raised if the provided zip file does not exist.