Загрузка данных


cd /var/www/html/cache && python3 - <<'PY'
import os, json

root = "/var/www/html/cache"
files = []

for dirpath, _, filenames in os.walk(root):
    for filename in filenames:
        if filename in ("cache.zip", "files.json"):
            continue

        full = os.path.join(dirpath, filename)
        rel = os.path.relpath(full, root).replace("\\", "/")

        files.append({
            "name": filename,
            "size": os.path.getsize(full),
            "path": rel,
            "url": "http://157.22.184.251/cache/" + rel
        })

files.sort(key=lambda x: x["path"])

with open(os.path.join(root, "files.json"), "w", encoding="utf-8") as f:
    json.dump({"files": files}, f, ensure_ascii=False, indent=2)

print(f"Готово! Файлов: {len(files)}")
print("URL: http://157.22.184.251/cache/")
PY