Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get(path)
- for a,b in pairs(fs.list(path)) do
- if fs.isDir(fs.combine(path,b)) then
- fld = fld + 1
- term.setTextColour(colours.yellow)
- print(string.rep("|",indent) .. "+"..b)
- indent = indent+1
- get("/" .. fs.combine(path,b))
- else
- fle = fle + 1
- if fs.isReadOnly(fs.combine(path,b)) then
- term.setTextColour(colours.red)
- else
- term.setTextColour(colours.green)
- end
- print(string.rep("|",indent) .. "|"..b)
- end
- sleep(0)
- end
- indent=indent-1
- end
- local tArgs = { ... }
- indent = 0
- fld = 0
- fle = 0
- if not tArgs or not fs.exists(tArgs[1]) or not fs.isDir(tArgs[1]) then
- error("Invalid target")
- else
- get(tArgs[1])
- print(fle .. " files," .. fld .. " folders")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement