cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Correct Way to move folders in batch mode Java API

Correct Way to move folders in batch mode Java API

Dario_Go
Explorer | Level 3
Go to solution

Hi. I need to move a lot of folders with files to another shared folder. I need to do that every day using Java API

 

But moving a got the messsage "too_many_write_operations". I read in the doc that we need to do that in batch mode.

 

Someone have a example to do that?

 

Thanks in advance.

 

Regards,

Dario.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

To move items in bulk using the Dropbox API v2 Java SDK, you should use moveBatch (or moveBatchBuilder) and moveBatchCheck.

 

We don't have a full example of that, but it would look like this:

 

List<RelocationPath> entries = new ArrayList<RelocationPath>();
entries.add(new RelocationPath("/folder1_original_path", "/folder1_new_path"));
entries.add(new RelocationPath("/folder2_original_path", "/folder2_new_path"));
// ... and so on

RelocationBatchLaunch moveBatchJob = client.files().moveBatch(entries);

RelocationBatchJobStatus moveBatchCheck = null;

while (moveBatchCheck == null || moveBatchCheck.isInProgress()) {
    // check this occasionally until it's done
    moveBatchCheck = client.files().moveBatchCheck(moveBatchJob.getAsyncJobIdValue());
    System.out.println(moveBatchCheck);
    Thread.sleep(10000);
}

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

To move items in bulk using the Dropbox API v2 Java SDK, you should use moveBatch (or moveBatchBuilder) and moveBatchCheck.

 

We don't have a full example of that, but it would look like this:

 

List<RelocationPath> entries = new ArrayList<RelocationPath>();
entries.add(new RelocationPath("/folder1_original_path", "/folder1_new_path"));
entries.add(new RelocationPath("/folder2_original_path", "/folder2_new_path"));
// ... and so on

RelocationBatchLaunch moveBatchJob = client.files().moveBatch(entries);

RelocationBatchJobStatus moveBatchCheck = null;

while (moveBatchCheck == null || moveBatchCheck.isInProgress()) {
    // check this occasionally until it's done
    moveBatchCheck = client.files().moveBatchCheck(moveBatchJob.getAsyncJobIdValue());
    System.out.println(moveBatchCheck);
    Thread.sleep(10000);
}

Dario_Go
Explorer | Level 3
Go to solution

Thanks!!!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Dario_Go Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?