3

I am trying to move some files from one folder to another.

This is my curl request:

curl -X POST https://api.dropboxapi.com/2/files/move \
  --header 'Authorization: Bearer faketokenjskahdLDAKHDALjdj8287ew98ehsahdkkadjhk' \
  --header 'Content-Type: application/json' \
  --data '{"from_path":"/folder1","to_path":"/folder2/folder2.1"}'

Whenever I call it I get this reponse:

{
  "error_summary": "to/conflict/folder/...",
  "error": {
    ".tag": "to",
    "to": {
      ".tag": "conflict",
      "conflict": {
        ".tag": "folder"
      }
    }
  }
}

The docs say the following about the specific key words in the response:

conflict :  Couldn't write to the target path because there was something in the way.

folder:  There's a folder in the way. 

How can there be a folder in the way? What does this even mean? I'm not sure what to do to solve this issue.

Docs for the /move endpoint can be found here

13
  • 2
    My assumption would be that there's already a folder at the path /folder2/folder2.1. Is that not true?
    – user94559
    Commented Mar 23, 2016 at 4:49
  • 1
    There is only another folder in folder2 - folder2.2. But nothing inside folder 2.1. Would that be interfering?
    – jgozal
    Commented Mar 23, 2016 at 11:27
  • 1
    I deleted folder 2.2 and retried the call but still getting the same error. The only other folder is folder 3 in the main directory but that shouldn't be causing the problem. Folder 2 has 2 folders, and folder 1 has 20 xml files that I want to move to 2.1 which is empty
    – jgozal
    Commented Mar 23, 2016 at 11:36
  • 1
    okay - so I deleted folder2 and was able to execute the call successfully but it doesn't really do what I want it do. I want to move/cut the contents of folder1 to folder 2.2 without creating new folders, and without getting rid of folder 1 (but removing the items in folder1). Am I going to need to use /copy and /delete with every file in the folder to do this?
    – jgozal
    Commented Mar 23, 2016 at 11:46
  • 1
    Urg... trying to use /copy now and still getting the same conflict error! Why can't I copy my files to an existing directory....
    – jgozal
    Commented Mar 23, 2016 at 11:56

1 Answer 1

4

Got this to work by requesting a list of the files in folder1/ then looping through each one of them and moving them from_path folder1/filename to_path folder2/folder2.1/filename

I needed to put the file name at the end of both paths to avoid any conflicts!

2
  • 2
    if you were able to move each file to "/folder2/folder2.1" without explicitly creating "/folder2/folder2.1" that must mean that the folder "folder2.1" in "/folder2" already existed, right? If "folder2.1" already exists it seems like the error is correct.
    – Chris
    Commented Mar 23, 2016 at 22:25
  • @brbob yup the folder already existed. I was under the impression that the folder needed to exist, as the to_path parameter is described in the docs as the path of the destination. Destinations are usually predefined.
    – jgozal
    Commented Mar 23, 2016 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.