Download Folder including Subfolder via wget from Dropbox link to Unix Server

后端 未结 4 1977
悲哀的现实
悲哀的现实 2021-02-05 10:10

I have a dropbox link like https://www.dropbox.com/sh/w4366ttcz6/AAB4kSz3adZ which opens the ususal dropbox site with folders and files. Is there any chance to download the com

相关标签:
4条回答
  • 2021-02-05 10:47

    Yes you can as it is pretty wasy follow below steps

    Firstly, get the dropbox share link. It will look like this https://www.dropbox.com/s/ad2arn440pu77si/test.txt

    Then add a “?dl=1” to the end of that url and a “-O filename” so that you end up with something like this: wget https://www.dropbox.com/s/ad2arn440pu77si/test.txt?dl=1 -O test.txt

    Now you can easily get files onto your linux.

    0 讨论(0)
  • 2021-02-05 11:01

    This help article documents some parameters you can use to get different behaviors from Dropbox shared links:

    https://www.dropbox.com/help/201

    For example, using this link:

    https://www.dropbox.com/sh/igoku2mqsjqsmx1/AAAeF57DR2ou_nZGC4JPoQKfa

    We can use the dl parameter to get a direct download. Using curl, we can download it as such:

    curl -L https://www.dropbox.com/sh/igoku2mqsjqsmx1/AAAeF57DR2ou_nZGC4JPoQKfa?dl=1 > download.zip
    

    (The -L is necessary in order to follow redirects.)

    Or, with wget, something like:

    wget --max-redirect=20 -O download.zip https://www.dropbox.com/sh/igoku2mqsjqsmx1/AAAeF57DR2ou_nZGC4JPoQKfa
    
    0 讨论(0)
  • 2021-02-05 11:01

    You can use --content-disposition with wget too.

    wget https://www.dropbox.com/sh/igoku2mqsjqsmx1/AAAeF57DR2ou_nZGC4JPoQKfa --content-disposition
    

    It will auto-detect the folder name as the zip filename.

    0 讨论(0)
  • 2021-02-05 11:03

    Currently, you're probably better off creating an app that you don't publish, which can either access all your files, or just a dedicated app folder (safer). Click the generate API token button about halfway down the app's settings page, and store it securely! You can then use the dedicated download or zip download API calls to get your files from anywhere like so:

    curl -X POST https://content.dropboxapi.com/2/files/download_zip \
        --header "Authorization: Bearer $MY_DROPBOX_API_TOKEN" \
        --header 'Dropbox-API-Arg: {"path": "/path/to/directory"}' \
        > useful-name.zip
    

    Adding your token as an environment variable makes it easier & safer to type/script these operations. If you're using BASH, and you have ignorespace in your $HISTCONTROL you can just type + paste your key with a leading space so it's not saved in your history. For frequent use, save it in a file with 0600 permissions that you can source, as you would an SSH key.

     export MY_DROPBOX_API_TOKEN='...'
    
    0 讨论(0)
提交回复
热议问题