Files
acc-installer/extract_acc.py
yassin1661-creator bafae4b212 init commit
2026-09-01 12:30:03 +03:30

50 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import shutil
import zipfile
def extract_acc_archive(base_drive: str = r"D:\\") -> str:
# تغییر نام پوشه اصلی به 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)
# ۱. بررسی وجود پوشه NovinSoft
if not os.path.exists(soft_dir):
raise FileNotFoundError(f"[-] پوشه یافت نشد: {soft_dir}")
# ۲. بررسی وجود فایل زیپ
if not os.path.exists(source_zip_path):
raise FileNotFoundError(f"[-] فایل {target_zip_name} در پوشه {soft_dir} پیدا نشد!")
# ۳. ایجاد پوشه NovinAcc در صورت عدم وجود
os.makedirs(acc_dir, exist_ok=True)
# ۴. انتقال فایل زیپ به NovinAcc
print(f"[+] در حال انتقال {target_zip_name} به پوشه NovinAcc...")
shutil.move(source_zip_path, target_zip_path)
print(" [✓] فایل زیپ منتقل شد.")
# ۵. استخراج فایل از حالت فشرده
print(f"[+] در حال آنزیپ کردن در {acc_dir}...")
with zipfile.ZipFile(target_zip_path, 'r') as zip_ref:
zip_ref.extractall(acc_dir)
print(" [✓] تمام فایل‌ها با موفقیت آنزیپ شدند.")
# ۶. حذف فایل زیپ موقت
if os.path.exists(target_zip_path):
os.remove(target_zip_path)
print(" [✓] فایل زیپ موقت پاک شد.")
return acc_dir
if __name__ == "__main__":
os.system("chcp 65001 > nul")
print("--- در حال اجرای ماژول انتقال و آنزیپ ---")
try:
extract_acc_archive(base_drive=r"D:\\")
except Exception as e:
print(e)