LolzPB

cat

May 21st, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. args = {...}
  2.  
  3. --Controllo se sono stati inseriti tutti i parametri
  4.  
  5. if args[1] == nil then
  6. print("Uso: cd <directory>")
  7. return
  8. end
  9.  
  10. --Controllo se la cartella esiste
  11. if not fs.isDir(args[1]) and not args[1] == ".." then
  12. print("Cartella non trovata")
  13. return
  14. end
  15.  
  16. --Controllo che tipo di cartella e'
  17. --if args[1] == ".." and not shell.dir() == "/" then
  18. -- dirs = {}
  19. -- for i in string.gmatch(shell.dir(), "/") do
  20. -- dirs[#dirs+1] = i
  21. -- end
  22. -- dir = ""
  23. -- for i=1, #dirs-1 do
  24. -- dir = dir..dirs[i].."/"
  25. -- end
  26. -- cDir = dir
  27. -- shell.setDir(cDir)
  28. -- return
  29. --end
  30.  
  31. --Cambio la cartella
  32. if fs.exists(shell.resolve(args[1])) then
  33. shell.setDir(shell.resolve(args[1]))
  34. end
Add Comment
Please, Sign In to add comment