<?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: check download file in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/615048#M2833</link>
    <description>&lt;P&gt;&lt;A href="https://unix.stackexchange.com/questions/474805/verify-if-a-url-exists" target="_blank"&gt;https://unix.stackexchange.com/questions/474805/verify-if-a-url-exists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I use the method and give error dropbox link,&lt;/P&gt;&lt;P&gt;it is return link exist&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2022 03:23:39 GMT</pubDate>
    <dc:creator>alicera</dc:creator>
    <dc:date>2022-08-10T03:23:39Z</dc:date>
    <item>
      <title>check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565365#M2300</link>
      <description>&lt;P&gt;If I get a link for dropbox and I use the 'wget' to download it.&lt;/P&gt;
&lt;P&gt;How to check it if download successfully?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 19:39:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565365#M2300</guid>
      <dc:creator>alicera</dc:creator>
      <dc:date>2021-12-22T19:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565480#M2301</link>
      <description>&lt;P&gt;You can check the HTTP status code of the response to see what the result is. For example, a 200 indicates success.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 18:47:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565480#M2301</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-12-21T18:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565528#M2302</link>
      <description>&lt;P&gt;wget -nc dropbox_url&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will download other file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 02:48:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565528#M2302</guid>
      <dc:creator>alicera</dc:creator>
      <dc:date>2021-12-22T02:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565619#M2303</link>
      <description>&lt;P&gt;I'm not sure I understand your latest message. Do you have a question a I can help with?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 13:56:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565619#M2303</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-12-22T13:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565621#M2304</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1501443"&gt;@alicera&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;For any kind of error that might come up on command line, you can check the retrieved result. For most commands (including 'wget'), success is denoted by zero. Any different exit status means that something happens considered as a error. File not found (HTTP status 404) gets transformed to server issued an error response - exit status 8, for example.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1501443"&gt;@alicera&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;wget -nc dropbox_url&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will download other file.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No, no another file will get downloaded, while 'dropbox_url' keeps the same. Keep in mind that in such a case existing file is NOT considered error! That's why you're getting success and probably got confused. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; To force existing file consideration as an error, you can use something like:&lt;/P&gt;&lt;PRE&gt;wget -nc -O filename.ext dropbox_url&lt;/PRE&gt;&lt;P&gt;Where 'filename.ext' is the desirable file name (possibly path prepended). Now (after explicit destination pointing) a try downloading already existing file (probably downloaded before) will result in general error (exit status 1, no more 0), which you can check. &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;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 13:59:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/565621#M2304</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2021-12-22T13:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/615048#M2833</link>
      <description>&lt;P&gt;&lt;A href="https://unix.stackexchange.com/questions/474805/verify-if-a-url-exists" target="_blank"&gt;https://unix.stackexchange.com/questions/474805/verify-if-a-url-exists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I use the method and give error dropbox link,&lt;/P&gt;&lt;P&gt;it is return link exist&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 03:23:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/615048#M2833</guid>
      <dc:creator>alicera</dc:creator>
      <dc:date>2022-08-10T03:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/615124#M2835</link>
      <description>&lt;P&gt;Ahh... &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1501443"&gt;@alicera&lt;/a&gt;, now I see what you mean.&lt;/P&gt;&lt;P&gt;You want to check not for error in transfer process or error because of existing (already) file, but link validity.&lt;/P&gt;&lt;P&gt;It's not so trivial cosa Dropbox links are dynamically generated and even when no real file exists link point to error message (as a content, it's still valid). That's why you are getting "200 OK" for both valid and invalid link (the error message is valid 🤫). But there is a workaround. &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; When some link is invalid, error message gets back immediately. If your link points to real file, redirect is performed to the pointed file. You can exploit this. 'wget' perform redirects by default and that's why always succeeds. If you disable redirects, a "strange" situation will happen: valid links will result in error (can't redirect), but invalid will succeed (redirect doesn't needed). So, inverting the check logic is going let you distinguish valid to invalid links. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; Use something like following template:&lt;/P&gt;&lt;PRE&gt;wget --method=HEAD -q --max-redirect 0 &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;lt;&lt;/SPAN&gt;some&lt;/SPAN&gt; &lt;SPAN class=""&gt;Dropbox&lt;/SPAN&gt; &lt;SPAN class=""&gt;shared&lt;/SPAN&gt; &lt;SPAN class=""&gt;link&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
echo $?&lt;/PRE&gt;&lt;P&gt;The above just print resulting code (currently 0 for invalid link - inverted logic). You can check it in conditional expression too, of course.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 12:30:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/615124#M2835</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2022-08-10T12:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: check download file</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/615160#M2837</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1501443"&gt;@alicera&lt;/a&gt; In addition to the method Здравко helpfully provided, you could use &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata" target="_blank"&gt;the /2/sharing/get_shared_link_metadata Dropbox API endpoint&lt;/A&gt; to retrieve the metadata for a shared link, or an error if the shared link is invalid.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 15:24:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/check-download-file/m-p/615160#M2837</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-08-10T15:24:39Z</dc:date>
    </item>
  </channel>
</rss>

