Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tVarargs = {...}
- local sDropboxFilename = tVarargs[1]
- local sLocalFilename = tVarargs[2]
- local iDropboxUser = 46643202
- --[[ Enter your dropbox user ID on the line above.
- To get your ID copy a public link and it's the long
- number after the /u/. ]]
- if #tVarargs ~= 2 then
- print("Usage: dropbox [remote filename] [filename]")
- return
- elseif not http then
- print("Please enable the HTTP API to used this program.")
- return
- elseif iDropboxUser == 0 then
- print("Please edit this program and change the Dropbox ID on line 4 to your own ID.")
- return
- end
- local sVersion = string.sub(os.version(), -3)
- local fileGet = {}
- if sVersion == "1.4" then
- fileGet = http.get("https://dl.dropbox.com/u/" .. iDropboxUser .. "/" .. sDropboxFilename)
- else
- fileGet = http.get("http://dl.dropbox.com/u/" .. iDropboxUser .. "/" .. sDropboxFilename)
- end
- if fs.exists(sLocalFilename) == true then
- fs.delete(sLocalFilename)
- end
- local tFile = fs.open(sLocalFilename, "w")
- tFile.write(fileGet.readAll())
- tFile.close()
- fileGet.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement