Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to download a file from a URL
- function downloadFile(url, destination)
- local response = http.get(url)
- if response then
- local content = response.readAll()
- response.close()
- local file = fs.open(destination, "w")
- file.write(content)
- file.close()
- print("Downloaded: " .. destination)
- else
- print("Failed to download: " .. url)
- end
- end
- -- Function to download all files from GitHub to the disk
- function downloadFromGitHubToDisk(githubRepoUrl, destinationPath)
- local baseURL = githubRepoUrl .. "/main" -- GitHub raw URL for the main branch
- -- List all files and their corresponding raw URLs
- local filesToDownload = {
- {"es", baseURL .. "/es"},
- {"startup", baseURL .. "/startup"},
- {"client/web", baseURL .. "/client/web"},
- {"dns/serverlist", baseURL .. "/dns/serverlist"},
- {"dns/startup", baseURL .. "/dns/startup"},
- {"server/core", baseURL .. "/server/core"},
- {"server/filestart", baseURL .. "/server/filestart"},
- {"server/server", baseURL .. "/server/server"},
- {"server/settings", baseURL .. "/server/settings"},
- {"server/startup", baseURL .. "/server/startup"},
- {"tempBlank/site/dynamic", baseURL .. "/tempBlank/site/dynamic"},
- {"tempBlank/site/home", baseURL .. "/tempBlank/site/home"},
- {"tempMusic/site/dynamic", baseURL .. "/tempMusic/site/dynamic"},
- {"tempMusic/site/home", baseURL .. "/tempMusic/site/home"},
- {"tempMusic/site/music", baseURL .. "/tempMusic/site/music"},
- {"tempMusic/site/redstone", baseURL .. "/tempMusic/site/redstone"},
- {"tempStore/site/dynamic", baseURL .. "/tempStore/site/dynamic"},
- {"tempStore/site/home", baseURL .. "/tempStore/site/home"},
- {"tempStore/site/store", baseURL .. "/tempStore/site/store"},
- -- Add more files here as needed
- }
- -- Download each file to the disk
- for _, fileData in ipairs(filesToDownload) do
- local destination = fs.combine(destinationPath, fileData[1])
- downloadFile(fileData[2], destination)
- end
- end
- -- Main function to copy files from GitHub to the disk
- function main()
- local githubRepoUrl = "https://raw.githubusercontent.com/SomethingBasic01/Dynet" -- Replace with your GitHub repository URL
- local diskPath = "disk" -- Path to the mounted disk drive in ComputerCraft
- if not fs.exists(diskPath) then
- print("Disk not found. Please insert a disk and try again.")
- return
- end
- downloadFromGitHubToDisk(githubRepoUrl, diskPath)
- print("All files have been downloaded from GitHub to the disk.")
- end
- -- Run the main function
- main()
Advertisement
Add Comment
Please, Sign In to add comment