Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --name dropbox
- --version 1
- function download(address)
- site = http.get(address)
- if site == nil then
- print("No file")
- else
- code = site.readAll()
- name = nil
- start = string.find(code, "name")
- if start ~= nil then
- length = string.find(code, "\n", start)
- name = string.sub(code, start+5, length-1)
- print("Downloaded: "..name)
- end
- start = string.find(code, "version")
- if start ~= nil then
- length = string.find(code, "\n", start)
- version = string.sub(code, start+8, length-1)
- print("Version: "..version)
- end
- if name ~= nil then
- file = fs.open(name,"w")
- file.write(code)
- file.close()
- else
- print("no name")
- end
- end
- end
- function files()
- file = fs.open("dropboxfiles","r")
- hasline = true
- files = {}
- i = 1
- while hasline do
- line = file.readLine()
- if line == nil then
- hasline = false
- else
- files[i] = line
- end
- i = i + 1
- end
- return files
- end
- urls = files()
- for i=1,#urls do
- download(urls[i])
- end
Advertisement
Add Comment
Please, Sign In to add comment