You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

mastis's avatar
mastis
Explorer | Level 4
4 years ago

filesMoveBatchV2 instead of moving files from one folder to another it just deletes the files.

Hello,

I am creating this app which upon request will move desired files from one folder to another. However, after request, files are being deleted instead of moved to another folder. To achieve this, I am using filesMoveBatchV2 call and it returns async_job_id. After checking async_job_id with filesMoveBatchCheckV2 call I receive status-completed, but if I check in my dropbox account, I cant see files being moved to desired folder but instead deleted. Hope you can help me. Here is my code.

 

await dbx.filesMoveBatchV2({
            entries:[{
              from_path: `/FromFolder`,
              to_path: '/ToFolder'
            }]
        }).then(async (res=>{
            let bl
            do{
            bl =  await dbx.filesMoveBatchCheckV2({
                    async_job_id : res.result.async_job_id
                })
            console.log("BL: "bl.result['.tag'])
            }
            while(bl.result['.tag'] === 'in_progress')
        }).catch((err)=>{
            console.log(err)
        })
  • tahsini's avatar
    tahsini
    Icon for Dropbox Staff rankDropbox Staff

    I attempted to replicate this on my own, and it seems to be working for me.

     

    From your code you are looking at the tag to see if it's complete or not. To check the completion status you can also look at the entries section which will give you back the metadata of the moved files and more information if that move failed. You can read more about the entries section and what's returned here.

    • mastis's avatar
      mastis
      Explorer | Level 4

      came to this point .

      {
      '.tag': 'relocation_error',
      relocation_error: { '.tag': 'from_lookup', from_lookup: { '.tag': 'not_found' } }
      }

       

       

      after reading documentation once again found this:

       

      RelocationError (open union)

      The value will be one of the following datatypes. New values may be introduced as our API evolves.

      from_lookup LookupError

      LookupError (open union)The value will be one of the following datatypes. New values may be introduced as our API evolves.
      not_found Void There is nothing at the given path. 
      Not sure what are my options. Any opinion helps
      • Здравко's avatar
        Здравко
        Legendary | Level 20

        Hi mastis,

        You are renaming a folder 'FromFolder', in your account root, to name 'ToFolder'. Am I right? Are you sure such a folder exists? 🧐

        Did you try to list your root' content; is there 'FromFolder'? Try that! Just take in mind when application is restricted to its own folder, that's the root which application can see only, NOT the actual account root.

        Hope this gives right direction.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,888 PostsLatest Activity: 24 hours ago
326 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!