Skip to content

How to download Google drive files using wget?

    Its tricky to get files download from google drive.

    If files have public access we can use below command to construct a download link and download using wget.

    wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
    

    https://gist.github.com/ankitmundada/7d15bc85ff1430d99a8467767c8ed2d2