Advertisement
TheRockettek

Untitled

Feb 25th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function get(path)
  2. for a,b in pairs(fs.list(path)) do
  3. if fs.isDir(fs.combine(path,b)) then
  4. fld = fld + 1
  5. term.setTextColour(colours.yellow)
  6. print(string.rep("|",indent) .. "+"..b)
  7. indent = indent+1
  8. get("/" .. fs.combine(path,b))
  9. else
  10. fle = fle + 1
  11. if fs.isReadOnly(fs.combine(path,b)) then
  12. term.setTextColour(colours.red)
  13. else
  14. term.setTextColour(colours.green)
  15. end
  16. print(string.rep("|",indent) .. "|"..b)
  17. end
  18. sleep(0)
  19. end
  20. indent=indent-1
  21. end
  22.  
  23. local tArgs = { ... }
  24. indent = 0
  25. fld = 0
  26. fle = 0
  27. if not tArgs or not fs.exists(tArgs[1]) or not fs.isDir(tArgs[1]) then
  28. error("Invalid target")
  29. else
  30. get(tArgs[1])
  31. print(fle .. " files," .. fld .. " folders")
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement