LolzPB

cp

May 21st, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. args = {...}
  2.  
  3. if #args < 2 then
  4. print("Uso: cp <directory> <copia>")
  5. return
  6. end
  7.  
  8. if not fs.exists(shell.resolve(args[1])) then
  9. print("Il file non esiste")
  10. return
  11. end
  12.  
  13. if fs.exists(shell.resolve(args[2])) then
  14. print("Il file esiste gia'")
  15. return
  16. end
  17.  
  18.  
  19.  
  20. file = fs.open(shell.resolve(args[1]), "r")
  21. cont = file.readAll()
  22. file.close()
  23. file = fs.open(shell.resolve(args[2]), "w")
  24. file.write(cont)
  25. file.close()
Add Comment
Please, Sign In to add comment