Advertisement
killer64

Untitled

Feb 4th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. if not http then
  2. error("http not ennabled!")
  3. end
  4. local basetree="http://pixeltoast.x64.me:25563/cc/"
  5. local function get(filename)
  6. http.request(basetree..filename)
  7. while true do
  8. local p={os.pullEvent()}
  9. if p[1]=="http_success" then
  10. return p[3].readAll()
  11. elseif p[1]=="http_failure" then
  12. error("could not get file: "..filename)
  13. end
  14. end
  15. end
  16. local list=textutils.unserialize("{"..string.gsub(get("filelist"),"\n",",").."}")
  17. for k,v in pairs(list) do
  18. print("downloading "..v)
  19. if fs.exists(v) then
  20. fs.delete(v)
  21. end
  22. if string.sub(v,-1,-1)=="/" then
  23. fs.makeDir(v)
  24. else
  25. local file=fs.open(v,"w")
  26. file.write(get(v))
  27. file.close()
  28. end
  29. end
  30. print("Done!")
  31. sleep(3)
  32. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement