bash 如何从 shell 下载所有谷歌文档
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2745948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to download all your google docs from shell
提问by Temujin
I learned how to download single google doc. But I am trying to make a script that downloads all my data in text format and then merges them in 1 text file. So, I wonder how to implement downloading part so that 1 can get zip file with all my files just as you do with web browser. Here is my newb script to get single file. Hope you can suggest some tweaks that make it more effective.
我学会了如何下载单个谷歌文档。但我正在尝试制作一个脚本,以文本格式下载我的所有数据,然后将它们合并到 1 个文本文件中。所以,我想知道如何实现下载部分,以便 1 可以像使用 Web 浏览器一样获取包含我所有文件的 zip 文件。这是我获取单个文件的 newb 脚本。希望你能提出一些调整,使其更有效。
#!/bin/bash
token=$(curl -s https://www.google.com/accounts/ClientLogin -d [email protected] -d Passwd=blahblah -d accountType=GOOGLE -d service=writely -d Gdata-version=3.0 |cut -d "=" -f 2)
set $token
wget --header "Gdata-Version: 3.0" --header "Authorization: GoogleLogin auth=" "https://docs.google.com/feeds/download/documents/Export?docID=${resourceId}&exportFormat=txt" -O /tmp/${file[$i]}.txt
Here I specify single resourceId, as you see. Should I just push many resourceId-s in download link to get them all or there is better way?
如您所见,这里我指定了单个resourceId。我应该在下载链接中推送许多resourceId-s 来获取它们,还是有更好的方法?
回答by Jeff
If you don't mind using a non-native tool I would highly recommend: http://code.google.com/p/googlecl/
如果您不介意使用非本地工具,我强烈推荐:http: //code.google.com/p/googlecl/
However, considering the age of this question, you may have already figured this out.
但是,考虑到这个问题的年龄,您可能已经弄清楚了。
回答by Claudio Cherubino
You can also use the Archive feed of the Documents List API to export your documents as a zip file:
您还可以使用 Documents List API 的 Archive feed 将您的文档导出为 zip 文件:
https://developers.google.com/google-apps/documents-list/#managing_archives_of_documents_and_files
https://developers.google.com/google-apps/documents-list/#managing_archives_of_documents_and_files

