We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

bookworm314's avatar
bookworm314
New member | Level 2
6 months ago

How do I make the wget command work with a Dropbox file or folder?

Basically what it says in the title. I have some Google Colab (i.e., Python) code to analyze data (in a .csv file), but I need to access that data first. I would like to store data files in Dropbox because we have more storage to spare than in Google Drive. But the !wget command, which I would ordinarily use to get a file off the web, doesn't seem to be playing nice with Dropbox. Here is what ChatGPT said: 

 

To use Dropbox files in Google Colab, you can follow these steps:

  1. Get the Shareable Link: First, make sure the file or folder you want to use is shared. Go to Dropbox, right-click on the file or folder, and select "Share." Then, generate a shareable link.

  2. Modify the Link: The generated link will start with "https://www.dropbox.com/". Change this part to "https://dl.dropboxusercontent.com/".

  3. Load the File in Colab: In a Colab notebook, you can use the wget command to download the file directly into your Colab environment. Here's an example:

     

    4. Accessing the File: Once downloaded, you can access the file like any other file in Colab.

    Remember, if you're working with multiple files or large datasets, you might want to consider using Dropbox API for more efficient handling. But for simple tasks, the above method should work fine.

     

    However, when I try that URL replacement, I get a 404 error trying to access the file through code or on the web. Is there another trick here? Thanks!

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

    bookworm314 wrote:

    ...

    However, when I try that URL replacement, I get a 404 error trying to access the file through code or on the web. Is there another trick here? Thanks!


    Hi bookworm314,

    Most likely you have damaged your link somehow.

    In general wget should work. Even more wget does some things automatically - redirection for instance. In fact the only thing you may change is transform link parameter "dl=0" to "dl=1" (residing usually at the link end). It will work also with domain change though. For more deep view on what's going on, run the command with parameter -d in addition (lot more information will get out). Create some dummy file and link pointing that file. Next execute wget with extended logging and post the command (exactly as executed) and its log here if you still cannot understand exactly what's wrong.

    Good luck.

    • steven15's avatar
      steven15
      New member | Level 2

      This is not working! Since the last horrible dropbox update, this issnt working anymore.
      Link with dl=0 works, link with dl=1 get a Error (400)

       

       

       

       

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

        Hi bookworm314,

        Can you post some failing command, exactly as you typed it, with example link - a link that otherwise works?

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
325 Following

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 or Facebook.

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!