We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

developersSave's avatar
developersSave
Helpful | Level 6
2 years ago

Move files and Folders

Hi everyone,  I've a question: I need to move files and folders using dropbox API in my Java project. Do you have some code examples? I can't find them online and I don't know if it's possibile do ...
  • developersSave's avatar
    developersSave
    2 years ago

    Hi Здравко ,

    I solved everything in this way (all Paths are made with a DropBox id):

     

    public static String moveFile(SuiteConfiguration suiteConfiguration,

    String fromPath,String toPath) throws RelocationErrorException, DbxException {

    DbxClientV2 dropboxClient = getV2Client(suiteConfiguration);

     "id:TMSaeghsn0AAAAAAAACV2w/ios.png").withAllowOwnershipTransfer(true).withAllowSharedFolder(true).withAutorename(true);

    RelocationResult result = dropboxClient.files().moveV2(fromPath, toPath);

    return result.getMetadata().getPathDisplay();

    }

     

    public static void moveFolder(SuiteConfiguration suiteConfiguration,

    String fromPath,String toPath) throws RelocationErrorException, DbxException, InterruptedException {

    DbxClientV2 dropboxClient = getV2Client(suiteConfiguration);

    MoveV2Builder withAllowSharedFolder = dropboxClient.files().moveV2Builder(fromPath,toPath).withAllowOwnershipTransfer(true).withAllowSharedFolder(true).withAutorename(false);

    RelocationResult result = withAllowSharedFolder.start();

    }

     

     

    Thank you for your help