Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

7 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    You can check the HTTP status code of the response to see what the result is. For example, a 200 indicates success.

  • alicera's avatar
    alicera
    Explorer | Level 3
    4 years ago

    wget -nc dropbox_url 

    It will download other file.

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    I'm not sure I understand your latest message. Do you have a question a I can help with?

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    4 years ago

    Hi alicera,

    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.


    alicera wrote:

    wget -nc dropbox_url 

    It will download other file.


    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. 🙂 To force existing file consideration as an error, you can use something like:

    wget -nc -O filename.ext dropbox_url

    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. 😉

    Hope this helps.

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    4 years ago

    Ahh... alicera, now I see what you mean.

    You want to check not for error in transfer process or error because of existing (already) file, but link validity.

    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. 😉 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. 🙂 Use something like following template:

    wget --method=HEAD -q --max-redirect 0 <some Dropbox shared link>
    echo $?

    The above just print resulting code (currently 0 for invalid link - inverted logic). You can check it in conditional expression too, of course.

    Hope this helps.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with other developers

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!