Advertisement
DOGGYWOOF

Untitled

Feb 11th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. local function copyRecursive(src, dest)
  2. if fs.isDir(src) then
  3. if not fs.exists(dest) then
  4. fs.makeDir(dest)
  5. end
  6. for _, item in ipairs(fs.list(src)) do
  7. copyRecursive(fs.combine(src, item), fs.combine(dest, item))
  8. end
  9. else
  10. fs.copy(src, dest)
  11. end
  12. end
  13.  
  14. local source = "/disk"
  15. local destination = "/disk2"
  16.  
  17. if not fs.exists(source) then
  18. print("Source disk not found.")
  19. return
  20. end
  21.  
  22. if not fs.exists(destination) then
  23. fs.makeDir(destination)
  24. end
  25.  
  26. copyRecursive(source, destination)
  27. print("Copy complete!")
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement