I've been searching how to do this, but i didn't find anything. After a while, i came up with the script i'll post as an answer. I'm posting this for myself and anyone who might find it useful.
You'll need to get a dropbox access token, that can be obtained after creating a dropbox app.
You can find an example HERE