Guest User

Untitled

a guest
Dec 15th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public class Main {
  2. private static final String ACCESS_TOKEN = "MY ACCESSTOCKEN";
  3. public static void main(String args[]) throws DbxException, IOException {
  4. DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
  5. DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
  6. FullAccount account = client.users().getCurrentAccount();
  7. ListFolderResult result = client.files().listFolder("");
  8. while (true) {
  9. for (Metadata metadata : result.getEntries()) { }
  10. if (!result.getHasMore()) {
  11. break;
  12. }
  13. result = client.files().listFolderContinue(result.getCursor());
  14. }
  15. try (InputStream in = new FileInputStream("test.txt")) {
  16. FileMetadata metadata = client.files().uploadBuilder("/test.txt")
  17. .uploadAndFinish(in);
  18. }
  19. }
  20. }
Add Comment
Please, Sign In to add comment