<?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 Upload Zip to Dropbox using Powershell in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Zip-to-Dropbox-using-Powershell/m-p/614368#M28373</link>
    <description>&lt;P&gt;i try to uploading zip file to dropbox via powershell, but it's taking forever, the file size is very small, please help and here is the powershell code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function SendFilesToDropbox()&lt;BR /&gt;{&lt;BR /&gt;foreach($zipfile in (Get-ChildItem -Filter "*.zip").Name )&lt;BR /&gt;{&lt;BR /&gt;Param(&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$SourceFilePath,&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$TargetFilePath,&lt;BR /&gt;[Parameter(mandatory=$true)]&lt;BR /&gt;[string]$DropboxTargetPath,&lt;BR /&gt;[Parameter(mandatory=$true)]&lt;BR /&gt;)&lt;BR /&gt;$DropboxTargetPath="/${env:USERNAME}_${zipfile}"&lt;BR /&gt;$arg = '{ "path": "' + ${DropboxTargetPath} + '", "mode": "add", "autorename": true, "mute": false }'&lt;BR /&gt;$authorization = "Bearer" + "sl.BMwi_zMyRe5c17nlb-zmvqmPsTO0wayqK80P0ZXt9XlYsC6tK1C3XPDSmiCIq7wslGZv7EDQaDezgOhD0DaouYjVDdknriidx5uu65nTUGVewJ3VkYYJLKaoqJ_mAdijBIniYcjE"&lt;BR /&gt;$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"&lt;BR /&gt;$headers.Add("Authorization", ${authorization})&lt;BR /&gt;$headers.Add("Dropbox-API-Arg", ${arg})&lt;BR /&gt;$headers.Add("Content-Type", 'application/octet-stream')&lt;BR /&gt;Invoke-RestMethod -Uri &lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt; -Method Post -InFile ${zipfile} -Headers ${headers}&lt;BR /&gt;&lt;BR /&gt;Remove-Item ${zipfile} -Force&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;#----------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;Set-Location "C:\ProgramData\WindowsUserAssist"&lt;BR /&gt;$LastUploadTime = (Get-Date)&lt;BR /&gt;$WhatFilesToZip = (Get-Date -Format yyyy_MM_dd_HH\\*)&lt;BR /&gt;$ZipArchiveName = (Get-Date -Format yyyy_MM_dd_HH.\zip)&lt;/P&gt;
&lt;P&gt;foreach($subdir in (Get-Childitem -Directory).Name)&lt;BR /&gt;{&lt;BR /&gt;if( ${subdir} -ne ${WhatFilesToZip}.SubString(0,13) )&lt;BR /&gt;{&lt;BR /&gt;Compress-Archive -Path "${subdir}\*" -CompressionLevel Optimal -DestinationPath "${subdir}.zip"&lt;BR /&gt;Remove-Item ${subdir} -Force -Recurse&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;if (Test-Connection dropbox.com) { SendFilesToDropbox }&lt;/P&gt;
&lt;P&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;$CurrentTime = (Get-Date)&lt;BR /&gt;&lt;BR /&gt;if(${LastUploadTime}.Hour -ne ${CurrentTime}.Hour )&lt;BR /&gt;{&lt;BR /&gt;Start-Sleep -Seconds 5&lt;BR /&gt;&lt;BR /&gt;Compress-Archive -Path "${WhatFilesToZip}" -CompressionLevel Optimal -DestinationPath "${ZipArchiveName}"&lt;BR /&gt;Remove-Item ${WhatFilesToZip}.SubString(0,13) -Force -Recurse&lt;BR /&gt;&lt;BR /&gt;if (Test-Connection dropbox.com) { SendFilesToDropbox }&lt;BR /&gt;&lt;BR /&gt;$LastUploadTime = (Get-Date)&lt;BR /&gt;$WhatFilesToZip = (Get-Date -Format yyyy_MM_dd_HH\\*)&lt;BR /&gt;$ZipArchiveName = (Get-Date -Format yyyy_MM_dd_HH.\zip)&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Start-Sleep -Seconds 1&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2022 12:50:22 GMT</pubDate>
    <dc:creator>kariasawayan291</dc:creator>
    <dc:date>2022-08-08T12:50:22Z</dc:date>
    <item>
      <title>Upload Zip to Dropbox using Powershell</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Zip-to-Dropbox-using-Powershell/m-p/614368#M28373</link>
      <description>&lt;P&gt;i try to uploading zip file to dropbox via powershell, but it's taking forever, the file size is very small, please help and here is the powershell code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function SendFilesToDropbox()&lt;BR /&gt;{&lt;BR /&gt;foreach($zipfile in (Get-ChildItem -Filter "*.zip").Name )&lt;BR /&gt;{&lt;BR /&gt;Param(&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$SourceFilePath,&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$TargetFilePath,&lt;BR /&gt;[Parameter(mandatory=$true)]&lt;BR /&gt;[string]$DropboxTargetPath,&lt;BR /&gt;[Parameter(mandatory=$true)]&lt;BR /&gt;)&lt;BR /&gt;$DropboxTargetPath="/${env:USERNAME}_${zipfile}"&lt;BR /&gt;$arg = '{ "path": "' + ${DropboxTargetPath} + '", "mode": "add", "autorename": true, "mute": false }'&lt;BR /&gt;$authorization = "Bearer" + "sl.BMwi_zMyRe5c17nlb-zmvqmPsTO0wayqK80P0ZXt9XlYsC6tK1C3XPDSmiCIq7wslGZv7EDQaDezgOhD0DaouYjVDdknriidx5uu65nTUGVewJ3VkYYJLKaoqJ_mAdijBIniYcjE"&lt;BR /&gt;$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"&lt;BR /&gt;$headers.Add("Authorization", ${authorization})&lt;BR /&gt;$headers.Add("Dropbox-API-Arg", ${arg})&lt;BR /&gt;$headers.Add("Content-Type", 'application/octet-stream')&lt;BR /&gt;Invoke-RestMethod -Uri &lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt; -Method Post -InFile ${zipfile} -Headers ${headers}&lt;BR /&gt;&lt;BR /&gt;Remove-Item ${zipfile} -Force&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;#----------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;Set-Location "C:\ProgramData\WindowsUserAssist"&lt;BR /&gt;$LastUploadTime = (Get-Date)&lt;BR /&gt;$WhatFilesToZip = (Get-Date -Format yyyy_MM_dd_HH\\*)&lt;BR /&gt;$ZipArchiveName = (Get-Date -Format yyyy_MM_dd_HH.\zip)&lt;/P&gt;
&lt;P&gt;foreach($subdir in (Get-Childitem -Directory).Name)&lt;BR /&gt;{&lt;BR /&gt;if( ${subdir} -ne ${WhatFilesToZip}.SubString(0,13) )&lt;BR /&gt;{&lt;BR /&gt;Compress-Archive -Path "${subdir}\*" -CompressionLevel Optimal -DestinationPath "${subdir}.zip"&lt;BR /&gt;Remove-Item ${subdir} -Force -Recurse&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;if (Test-Connection dropbox.com) { SendFilesToDropbox }&lt;/P&gt;
&lt;P&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;$CurrentTime = (Get-Date)&lt;BR /&gt;&lt;BR /&gt;if(${LastUploadTime}.Hour -ne ${CurrentTime}.Hour )&lt;BR /&gt;{&lt;BR /&gt;Start-Sleep -Seconds 5&lt;BR /&gt;&lt;BR /&gt;Compress-Archive -Path "${WhatFilesToZip}" -CompressionLevel Optimal -DestinationPath "${ZipArchiveName}"&lt;BR /&gt;Remove-Item ${WhatFilesToZip}.SubString(0,13) -Force -Recurse&lt;BR /&gt;&lt;BR /&gt;if (Test-Connection dropbox.com) { SendFilesToDropbox }&lt;BR /&gt;&lt;BR /&gt;$LastUploadTime = (Get-Date)&lt;BR /&gt;$WhatFilesToZip = (Get-Date -Format yyyy_MM_dd_HH\\*)&lt;BR /&gt;$ZipArchiveName = (Get-Date -Format yyyy_MM_dd_HH.\zip)&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Start-Sleep -Seconds 1&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 12:50:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Zip-to-Dropbox-using-Powershell/m-p/614368#M28373</guid>
      <dc:creator>kariasawayan291</dc:creator>
      <dc:date>2022-08-08T12:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Upload Zip to Dropbox using Powershell</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Zip-to-Dropbox-using-Powershell/m-p/614601#M28378</link>
      <description>&lt;P&gt;As for the connection speed for the upload requests, note that y&lt;SPAN class="mwjuzq-2 eecHOY"&gt;our connection speed to Dropbox depends on the routing you get between your ISP and our servers, and may be slower than your ISP's rated speeds. Sometimes resetting or retrying your connection gets you a different route and better speeds, but that is outside of our control. Some ISPs also throttle sustained connections so if you see an initial high connection speed followed by lower speeds, that could be the reason.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="mwjuzq-2 eecHOY"&gt;Also, I see you may be uploading multiple files to Dropbox serially in that 'foreach' loop. Check out &lt;A href="https://developers.dropbox.com/dbx-performance-guide" target="_blank"&gt;the Performance Guide&lt;/A&gt; for ways you may be able to optimize this, e.g., by uploading files in parallel and then committing them all at once.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, I see there is more code here than for just the Dropbox upload itself, but we can't offer help with that part unfortunately, as that's not about the Dropbox API.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 14:21:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-Zip-to-Dropbox-using-Powershell/m-p/614601#M28378</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-08-08T14:21:44Z</dc:date>
    </item>
  </channel>
</rss>

