tommarek_CZE

Untitled

Aug 7th, 2025
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. -- Function to download a file from a URL
  2. function downloadFile(url, destination)
  3. local response = http.get(url)
  4. if response then
  5. local content = response.readAll()
  6. response.close()
  7.  
  8. local file = fs.open(destination, "w")
  9. file.write(content)
  10. file.close()
  11. print("Downloaded: " .. destination)
  12. else
  13. print("Failed to download: " .. url)
  14. end
  15. end
  16.  
  17. -- Function to download all files from GitHub to the disk
  18. function downloadFromGitHubToDisk(githubRepoUrl, destinationPath)
  19. local baseURL = githubRepoUrl .. "/main" -- GitHub raw URL for the main branch
  20.  
  21. -- List all files and their corresponding raw URLs
  22. local filesToDownload = {
  23. {"es", baseURL .. "/es"},
  24. {"startup", baseURL .. "/startup"},
  25. {"client/web", baseURL .. "/client/web"},
  26. {"dns/serverlist", baseURL .. "/dns/serverlist"},
  27. {"dns/startup", baseURL .. "/dns/startup"},
  28. {"server/core", baseURL .. "/server/core"},
  29. {"server/filestart", baseURL .. "/server/filestart"},
  30. {"server/server", baseURL .. "/server/server"},
  31. {"server/settings", baseURL .. "/server/settings"},
  32. {"server/startup", baseURL .. "/server/startup"},
  33. {"tempBlank/site/dynamic", baseURL .. "/tempBlank/site/dynamic"},
  34. {"tempBlank/site/home", baseURL .. "/tempBlank/site/home"},
  35. {"tempMusic/site/dynamic", baseURL .. "/tempMusic/site/dynamic"},
  36. {"tempMusic/site/home", baseURL .. "/tempMusic/site/home"},
  37. {"tempMusic/site/music", baseURL .. "/tempMusic/site/music"},
  38. {"tempMusic/site/redstone", baseURL .. "/tempMusic/site/redstone"},
  39. {"tempStore/site/dynamic", baseURL .. "/tempStore/site/dynamic"},
  40. {"tempStore/site/home", baseURL .. "/tempStore/site/home"},
  41. {"tempStore/site/store", baseURL .. "/tempStore/site/store"},
  42. -- Add more files here as needed
  43. }
  44.  
  45. -- Download each file to the disk
  46. for _, fileData in ipairs(filesToDownload) do
  47. local destination = fs.combine(destinationPath, fileData[1])
  48. downloadFile(fileData[2], destination)
  49. end
  50. end
  51.  
  52. -- Main function to copy files from GitHub to the disk
  53. function main()
  54. local githubRepoUrl = "https://raw.githubusercontent.com/SomethingBasic01/Dynet" -- Replace with your GitHub repository URL
  55. local diskPath = "disk" -- Path to the mounted disk drive in ComputerCraft
  56.  
  57. if not fs.exists(diskPath) then
  58. print("Disk not found. Please insert a disk and try again.")
  59. return
  60. end
  61.  
  62. downloadFromGitHubToDisk(githubRepoUrl, diskPath)
  63. print("All files have been downloaded from GitHub to the disk.")
  64. end
  65.  
  66. -- Run the main function
  67. main()
Advertisement
Add Comment
Please, Sign In to add comment