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: 

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

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

mastis
Explorer | Level 4

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)
        })
4 Replies 4

tahsini
Dropbox 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
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

Здравко
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.

mastis
Explorer | Level 4

Thank you for your reply @Здравко,

 

Unfortunately, this was not the case. But I found the problem. In the field from_path and to_path, I didn't specify the file name to which I want to relocate as I thought fileMoveBatchv2 will move the whole folder. If anyone will have this problem, don't forget to specify the file name in from_path and also in to_path fields.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    mastis Explorer | Level 4
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    tahsini Dropbox Staff
What do Dropbox user levels mean?