<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Batch copy within Dropbox gives an error in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410336#M22208</link>
    <description>&lt;P&gt;Hello All!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Dropbox Javascript SDK to manage my files within Dropbox. I have come across a scenario where I need to copy 1 or many files (depends) into a single folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this, I am using the&amp;nbsp;&lt;SPAN&gt;filesCopyV2 api and proving different paths as the source, but the destination would be the same. Here's the sample code which I have tried in Node JS.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;const randomNum = makeRandomId(10);
const filePaths = [];

        files.forEach(file =&amp;gt; filePaths.push({ from_path: '/Source/' + file, to_path: '/Destination/' + randomNum }));
        const result = await dbx.filesCopyBatchV2({ entries: filePaths, autorename: false });
        console.log(result);&lt;/PRE&gt;&lt;P&gt;Now when I execute this piece of code, it works fine for the first file only. Starting from the next file, I am getting a relocation error. The response is shown below:&lt;/P&gt;&lt;PRE&gt;{
    ".tag": "complete",
    "entries": [
        {
            ".tag": "success",
            "success": {
                ".tag": "folder",
                "name": "KQMcvsrofA",
                "path_lower": "/destination/kqmcvsrofa",
                "path_display": "/Destination/KQMcvsrofA",
                "id": "id:BhIiassdeAAALg"
            }
        },
        {
            ".tag": "failure",
            "failure": {
                ".tag": "relocation_error",
                "relocation_error": {
                    ".tag": "to",
                    "to": {
                        ".tag": "conflict",
                        "conflict": {
                            ".tag": "folder"
                        }
                    }
                }
            }
        }
    ]
}&lt;/PRE&gt;&lt;P&gt;For instance, if I were to copy 2 files, the first file is copied and the second file is not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I solve this issue? I hope I am using the correct API provided by official Dropbox Team but please correct me if I am wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 15 Apr 2020 15:20:20 GMT</pubDate>
    <dc:creator>sajadjaward1</dc:creator>
    <dc:date>2020-04-15T15:20:20Z</dc:date>
    <item>
      <title>Batch copy within Dropbox gives an error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410336#M22208</link>
      <description>&lt;P&gt;Hello All!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Dropbox Javascript SDK to manage my files within Dropbox. I have come across a scenario where I need to copy 1 or many files (depends) into a single folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this, I am using the&amp;nbsp;&lt;SPAN&gt;filesCopyV2 api and proving different paths as the source, but the destination would be the same. Here's the sample code which I have tried in Node JS.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;const randomNum = makeRandomId(10);
const filePaths = [];

        files.forEach(file =&amp;gt; filePaths.push({ from_path: '/Source/' + file, to_path: '/Destination/' + randomNum }));
        const result = await dbx.filesCopyBatchV2({ entries: filePaths, autorename: false });
        console.log(result);&lt;/PRE&gt;&lt;P&gt;Now when I execute this piece of code, it works fine for the first file only. Starting from the next file, I am getting a relocation error. The response is shown below:&lt;/P&gt;&lt;PRE&gt;{
    ".tag": "complete",
    "entries": [
        {
            ".tag": "success",
            "success": {
                ".tag": "folder",
                "name": "KQMcvsrofA",
                "path_lower": "/destination/kqmcvsrofa",
                "path_display": "/Destination/KQMcvsrofA",
                "id": "id:BhIiassdeAAALg"
            }
        },
        {
            ".tag": "failure",
            "failure": {
                ".tag": "relocation_error",
                "relocation_error": {
                    ".tag": "to",
                    "to": {
                        ".tag": "conflict",
                        "conflict": {
                            ".tag": "folder"
                        }
                    }
                }
            }
        }
    ]
}&lt;/PRE&gt;&lt;P&gt;For instance, if I were to copy 2 files, the first file is copied and the second file is not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I solve this issue? I hope I am using the correct API provided by official Dropbox Team but please correct me if I am wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 15:20:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410336#M22208</guid>
      <dc:creator>sajadjaward1</dc:creator>
      <dc:date>2020-04-15T15:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Batch copy within Dropbox gives an error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410349#M22210</link>
      <description>&lt;P&gt;This 'failure/relocation_error/to/conflict/folder' error indicates that the operation failed because there is already a folder at the destination path you specified.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that when specifying a destination path like this, you should specify the full path where you want to put the item, including both the path of the parent folder, as well as the desired name of the file/folder itself.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code, you're setting the destination as `'/Destination/' + randomNum ` for each `file`, and you mentioned "the destination would be the same", so it sounds like this error is to be expected. You will need to set a distinct `to_path` for each item. For example, perhaps you want to do something like:&lt;/P&gt;
&lt;PRE&gt;to_path: '/Destination/' + randomNum + '/' + file&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Apr 2020 15:45:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410349#M22210</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-04-15T15:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Batch copy within Dropbox gives an error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410650#M22216</link>
      <description>&lt;P&gt;Thank you for replying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way that I can copy all the files from different paths into a same destination folder? I do not want to end up having so many folders created at the destination for each file that I am copying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does Dropbox have an API which supports this method?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 07:36:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410650#M22216</guid>
      <dc:creator>sajadjaward1</dc:creator>
      <dc:date>2020-04-16T07:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Batch copy within Dropbox gives an error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410779#M22221</link>
      <description>&lt;P&gt;Yes, you can use this&amp;nbsp;filesCopyBatchV2 method to copy files from multiple different locations into one folder. When doing so though, each 'to_path' shouldn't all be exactly the same. The 'to_path's can all be inside the same folder, but they should include the different file names so they don't conflict with each other.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 14:43:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Batch-copy-within-Dropbox-gives-an-error/m-p/410779#M22221</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-04-16T14:43:54Z</dc:date>
    </item>
  </channel>
</rss>

