<?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 Re: Trouble moving individual file based on selection in listWidget: Python API in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-moving-individual-file-based-on-selection-in-listWidget/m-p/626709#M28981</link>
    <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1579180"&gt;@RogueBotanist&lt;/a&gt; As Здравко noted, the code you shared is written to move the folder itself. If you want to move a specific file, you need to set the from_path parameter to be the whole path, including file name, to the file that you want to move. Likewise, the to_path parameter needs to the be whole path, including file name, where you want to move the file. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The 'entries' list in the&amp;nbsp;ListFolderResult returned by &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.files_list_folder" target="_blank"&gt;files_list_folder&lt;/A&gt;/&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.files_list_folder_continue" target="_blank"&gt;files_list_folder_continue&lt;/A&gt; is a list of &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/files.html#dropbox.files.Metadata" target="_blank"&gt;Metadata&lt;/A&gt;, so you can get the full path for any particular item from the Metadata.path_lower field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, note that the newer &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.files_move_v2" target="_blank"&gt;files_move_v2&lt;/A&gt; method is preferred over files_move.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 15:45:00 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2022-10-03T15:45:00Z</dc:date>
    <item>
      <title>Trouble moving individual file based on selection in listWidget: Python API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-moving-individual-file-based-on-selection-in-listWidget/m-p/626532#M28970</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm struggling to interact with a file in a folder based on the selection in a listWidget.&lt;/P&gt;
&lt;P&gt;I have verified the selection works as I can remove selected items from the listWidget. I however am having difficult moving the file in dropbox to another folder. Here's my method:&lt;/P&gt;
&lt;P&gt;def archive():&lt;BR /&gt;itemList = []&lt;BR /&gt;currentIndex = listWidget.currentRow()&lt;BR /&gt;item = listWidget.item(currentIndex)&lt;BR /&gt;for x in dbx.files_list_folder('/Testing Application').entries:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;itemList.append(str(x.name))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;dbx.files_move(from_path ='/Testing Application',to_path= '/Archived', autorename=False)&lt;BR /&gt;item = listWidget.takeItem(currentIndex)&lt;BR /&gt;del item&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how I listed the files in the listWidget:&lt;/P&gt;
&lt;P&gt;activeList = []&lt;BR /&gt;for item in dbx.files_list_folder('/Testing Application').entries:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;cell = QListWidgetItem(str(item.name))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;activeList.append(str(item.name))&lt;BR /&gt;listWidget.addItems(activeList)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I know I only have the name and I need to connect the selection of the name back to the original file. I could just do that by index, if index[list] = index[dbx] Move file.&lt;/P&gt;
&lt;P&gt;But I am having difficulty moving the file. I have my selection mode in the app set to singleSelection so currently it throws an error because it's trying to move everything in the folder. When it was set to multiSelection it moved everything.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need help selecting an individual file and moving just that one file.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 05:50:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-moving-individual-file-based-on-selection-in-listWidget/m-p/626532#M28970</guid>
      <dc:creator>RogueBotanist</dc:creator>
      <dc:date>2022-10-03T05:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble moving individual file based on selection in listWidget: Python API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-moving-individual-file-based-on-selection-in-listWidget/m-p/626653#M28976</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1579180"&gt;@RogueBotanist&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;dbx.files_move(from_path ='/Testing Application',to_path= '/Archived', autorename=False)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;But I am having difficulty moving the file. I have my selection mode in the app set to singleSelection so currently it throws an error because it's trying to move everything in the folder. When it was set to multiSelection it &lt;STRONG&gt;&lt;U&gt;moved everything&lt;/U&gt;&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1579180"&gt;@RogueBotanist&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@D88F213CAFB196B6AB70612B08AD9D31/emoticons/1f601.png" alt=":beaming_face_with_smiling_eyes:" title=":beaming_face_with_smiling_eyes:" /&gt; No, no,... it doesn't "moved everything"; it does "moved" just one thing - the folder itself. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt; You just haven't pointed anything else; it's always the folder itself. The source and destination of move have to be full path to the target - either file or folder (it's file in your case) in both places.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 12:44:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-moving-individual-file-based-on-selection-in-listWidget/m-p/626653#M28976</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2022-10-03T12:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble moving individual file based on selection in listWidget: Python API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-moving-individual-file-based-on-selection-in-listWidget/m-p/626709#M28981</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1579180"&gt;@RogueBotanist&lt;/a&gt; As Здравко noted, the code you shared is written to move the folder itself. If you want to move a specific file, you need to set the from_path parameter to be the whole path, including file name, to the file that you want to move. Likewise, the to_path parameter needs to the be whole path, including file name, where you want to move the file. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The 'entries' list in the&amp;nbsp;ListFolderResult returned by &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.files_list_folder" target="_blank"&gt;files_list_folder&lt;/A&gt;/&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.files_list_folder_continue" target="_blank"&gt;files_list_folder_continue&lt;/A&gt; is a list of &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/files.html#dropbox.files.Metadata" target="_blank"&gt;Metadata&lt;/A&gt;, so you can get the full path for any particular item from the Metadata.path_lower field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, note that the newer &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox.files_move_v2" target="_blank"&gt;files_move_v2&lt;/A&gt; method is preferred over files_move.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 15:45:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trouble-moving-individual-file-based-on-selection-in-listWidget/m-p/626709#M28981</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-10-03T15:45:00Z</dc:date>
    </item>
  </channel>
</rss>

