Advertisement
HappySunChild

copy

Apr 16th, 2025 (edited)
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. if not turtle then
  2.     return
  3. end
  4.  
  5. term.clear()
  6. term.setCursorPos(1, 1)
  7.  
  8. if not fs.exists("disk/copy") then
  9.     printError("No copy directory.")
  10.  
  11.     return
  12. end
  13.  
  14. print("copying files...")
  15.  
  16. local files = fs.list("disk/copy")
  17.  
  18. for _, file in ipairs(files) do
  19.     print("copying", file)
  20.  
  21.     local path = "disk/copy/" .. file
  22.     local dest = "/" .. file
  23.  
  24.     if fs.exists(dest) then
  25.         fs.delete(dest)
  26.     end
  27.  
  28.     fs.copy(path, dest)
  29. end
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement