bash – 如何从shell下载所有的google文档

我学会了如何下载单个谷歌文档.但我正在尝试制作一个脚本,以文本格式下载我的所有数据,然后将它们合并到一个文本文件中.所以,我想知道如何实现下载部分,以便1可以像使用Web浏览器一样获得所有文件的zip文件.这是我的新脚本来获取单个文件.希望你能提出一些调整,使其更有效.

#!/bin/bash
token=$(curl -s https://www.google.com/accounts/ClientLogin -d Email=user.name@gmail.com -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=$3" "https://docs.google.com/feeds/download/documents/Export?docID=${resourceId}&exportFormat=txt" -O /tmp/${file[$i]}.txt

在这里,我指定单个resourceId,如您所见.我应该在下载链接中推送多个resourceId-s来获取它们还是有更好的方法?

最佳答案 如果你不介意使用非原生工具,我强烈推荐:
http://code.google.com/p/googlecl/

但是,考虑到这个问题的年龄,你可能已经想到了这一点.

点赞