以下の内容はhttps://phst.hateblo.jp/entry/2026/01/27/173000より取得しました。


Python: ディスクを埋め尽くすコード

from pathlib import Path

target_dir = r"D:"
chunk_mb=100

target = Path(target_dir)
target.mkdir(parents=True, exist_ok=True)

chunk = b"\0" * (chunk_mb * 1024 * 1024)
i = 0
written_bytes = 0
next_report = 1 * 1024**3  # 1GB

while True:
    path = target / f"fill_{i:06d}.bin"
    if path.exists():
        i+=1
        continue
    try:
        with path.open("wb") as f:
            f.write(chunk)
            written_bytes += len(chunk)
            if written_bytes >= next_report:
                total, used, free = shutil.disk_usage(path)
                print(f"{written_bytes // 1024**3} GB written free={free/1024**3:.2f} GB")
                next_report += 1 * 1024**3            
    except OSError as e:
        print(f"停止: {e}")
        break
    i += 1



以上の内容はhttps://phst.hateblo.jp/entry/2026/01/27/173000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14