import os import shutil import zipfile def extract_acc_archive(base_drive: str = r"D:\\") -> str: # Base directory set to NovinPardazOne base_dir = os.path.join(base_drive, "NovinPardazOne") soft_dir = os.path.join(base_dir, "NovinSoft") acc_dir = os.path.join(base_dir, "NovinAcc") target_zip_name = "NovinAcc.zip" source_zip_path = os.path.join(soft_dir, target_zip_name) target_zip_path = os.path.join(acc_dir, target_zip_name) # 1. Check if NovinSoft directory exists if not os.path.exists(soft_dir): raise FileNotFoundError(f"[-] Directory not found: {soft_dir}") # 2. Check if zip file exists if not os.path.exists(source_zip_path): raise FileNotFoundError(f"[-] File {target_zip_name} was not found in {soft_dir}!") # 3. Create NovinAcc directory if it doesn't exist os.makedirs(acc_dir, exist_ok=True) # 4. Move zip file to NovinAcc print(f"[+] Moving {target_zip_name} to NovinAcc directory...") shutil.move(source_zip_path, target_zip_path) print(" [+] Zip file moved successfully.") # 5. Extract archive print(f"[+] Extracting archive to {acc_dir}...") with zipfile.ZipFile(target_zip_path, 'r') as zip_ref: zip_ref.extractall(acc_dir) print(" [+] All files extracted successfully.") # 6. Remove temporary zip file if os.path.exists(target_zip_path): os.remove(target_zip_path) print(" [+] Temporary zip file deleted.") return acc_dir if __name__ == "__main__": os.system("chcp 65001 > nul") print("[+] Running move and extract module ...") try: extract_acc_archive(base_drive=r"D:\\") except Exception as e: print(f"[-] Error: {e}")