-- http://justus.l--n.de:3000/JUFS/MDB/raw/branch/main/main.lua -- or use bootstrapper print("Copyright JUFS Technologies aka. Justus Wolff 2026") print("MDB - Multi disk Data Base") print("init API") local API = {} function API.getDisks() local disks = {peripheral.find("drive")} local out = {} for _,v in pairs(disks) do if v.isDiskPresent() and v.hasData() then table.insert(out, v.getMountPath()) end end return out end function API._builtCandidateTree(...) local path = {...} local candidates = {} for _,v in pairs(API.getDisks()) do for _,newcan in pairs(fs.list(v)) do table.insert(candidates, fs.combine(v, newcan)) end end for _,v in pairs(path) do local temp = {} for _,cc in pairs(candidates) do if fs.getName(cc) == v then table.insert(temp, cc) end end candidates = temp end return candidates end function API.list(...) local final = {} for _,v in pairs(API._builtCandidateTree(...)) do table.insert(final, fs.list(v)) end return final end print("Disks: ") local disks = API.getDisks() for _,v in pairs(disks) do print(" "..v..": "..tostring(fs.getFreeSpace("/")).."/"..tostring(fs.getCapacity("/"))) end for _,v in pairs(API.list()) do print(v) end return API