Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Disk Scanner for mounts like disk, diskX, diskXX
- local function getDiskMounts()
- local mounts = {}
- for _, name in ipairs(peripheral.getNames()) do
- if peripheral.getType(name) == "diskDrive" then
- local mount = peripheral.call(name, "getMountPath")
- if mount and string.find(mount, "^disk") then
- table.insert(mounts, {name = name, path = mount})
- end
- end
- end
- return mounts
- end
- local diskMounts = getDiskMounts()
- local totalSpace = 0
- print("🔍 Scanning mounted disks:\n")
- for i, disk in ipairs(diskMounts) do
- local free = fs.getFreeSpace(disk.path)
- totalSpace = totalSpace + free
- print(string.format("Disk %02d @ %s", i, disk.path))
- print(" Peripheral: " .. disk.name)
- print(" Free Space: " .. tostring(free) .. " bytes\n")
- end
- print("📦 Total available space across all disks: " .. totalSpace .. " bytes")
Advertisement
Add Comment
Please, Sign In to add comment