LolzPB

ls

May 21st, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. args = {...}
  2.  
  3. cDir = ""
  4.  
  5.  
  6. --Controllo la cartella richiesta
  7. if args[1] == nil then
  8. cDir = shell.dir()
  9. else
  10. if fs.isDir(args[1]) then
  11. cDir = shell.resolve(args[1])
  12. else
  13. print("Cartella non trovata")
  14. return
  15. end
  16. end
  17.  
  18. dirs = {}
  19. files = {}
  20.  
  21. --Printo tutti i file e cartelle che ci sono
  22. for i, k in pairs(fs.list(cDir)) do
  23. if fs.isDir(cDir.."/"..k) then
  24. table.insert(dirs, k)
  25. else
  26. table.insert(files, k)
  27. end
  28. end
  29. textutils.pagedTabulate(colors.blue, dirs, colors.red, files)
Advertisement
Add Comment
Please, Sign In to add comment