cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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

bookworm314
New member | Level 2

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!

2 Replies 2

Здравко
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.

Greg-DB
Dropbox Staff

@bookworm314 For information on how to use the URL parameters to get different behaviors, such as direct data access, please refer to this help center article: https://help.dropbox.com/share/force-download

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?