15 lines
402 B
Python
15 lines
402 B
Python
import os, shutil
|
|
|
|
drive = "H:\\"
|
|
exists = os.path.exists(drive)
|
|
print(f"Drive {drive} exists: {exists}")
|
|
if exists:
|
|
try:
|
|
total, used, free = shutil.disk_usage(drive)
|
|
print(f"Total: {total / (1024**3):.2f} GB")
|
|
print(f"Free: {free / (1024**3):.2f} GB")
|
|
print("Contents:", os.listdir(drive))
|
|
except Exception as e:
|
|
print("Error reading drive info:", e)
|
|
|