File size: 1,031 Bytes
c1596ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os
import zipfile

# ================================
# 0. ์„ค์ •
# ================================
TARGET_COUNT = 60
MIN_RES = 128  # ํ•ด์ƒ๋„ 128
PREFIX = "kg"
BASE_DIR = "./data/raw"

# ================================
# 1. ๊ฒฝ๋กœ
# ================================
ZIP_DIR = "data/raw_full_kg"

# ์••์ถ• ํ•ด์ œ ์œ„์น˜
EXTRACT_DIR = os.path.join(ZIP_DIR, "extracted")

os.makedirs(EXTRACT_DIR, exist_ok=True)

# ================================
# 2. zip ํŒŒ์ผ ๋ชฉ๋ก
# ================================
zip_files = [
    f for f in os.listdir(ZIP_DIR)
    if f.endswith(".zip")
]

# ================================
# 3. ์••์ถ• ํ•ด์ œ
# ================================
for zip_file in zip_files:
    zip_path = os.path.join(ZIP_DIR, zip_file)

    print(f"{zip_file} ์••์ถ• ํ•ด์ œ ์ค‘...")

    try:
        with zipfile.ZipFile(zip_path, "r") as zip_ref:
            zip_ref.extractall(EXTRACT_DIR)

    except Exception as e:
        print(f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {zip_file} โ†’ {e}")

print("๋ชจ๋“  ์••์ถ• ํ•ด์ œ ์™„๋ฃŒ!")