如何从Gmail下载许多电子邮件附件(How to download many email attachments from gmail)
我有一个设备,它将每日统计信息作为gmail电子邮件地址的附件发送。 过滤器标识发件人并将邮件隔离到邮箱中的文件夹中。 目前已累计约2000封电子邮件。 我需要下载这些附件,以便汇总和分析数据。 我想我可以写一个宏来移动鼠标,点击屏幕上的正确位置等等但是想知道是否有一种编程方式来简单地从文件夹中的所有电子邮件下载所有附件。
I have a device that sends daily statistics as an attachment to an email address at gmail. A filter identifies the sender and sequesters the mails into a folder in the mailbox. Currently ~2000 emails have accumulated. I need to download these attachments so the data can be aggregated and analyzed. I supposed I could write a macro to move the mouse, click the right places on the screen, etc. but was wondering if there is a programmatic way to simply download all the attachments from all the emails in a folder.
原文:https://stackoverflow.com/questions/37262556
最满意答案
[更新:从Go 1.8开始,
GOPATH
默认为$HOME/go
,但如果您想了解GOPATH
布局,自定义等等,您可能仍然会发现这有用)官方Go站点讨论了GOPATH以及如何布局工作区目录 。
export GOPATH="$HOME/your-workspace-dir/"
- 在shell中运行它,然后将其添加到~/.bashrc
或等效项,以便将来会为您设置。 Go将在src/
,bin/
和pkg/
下安装包。 如果您想发布到GitHub,您可以将自己的软件包放在$GOPATH/src
之下,如$GOPATH/src/github.com/myusername/
。 您也可能希望在.bashrc
export PATH=$PATH:$GOPATH/bin
,以便您可以在$GOPATH
下运行编译的程序。或者, 通过Rob Pike ,您还可以设置
CDPATH
以便在bash中打包export CDPATH=.:$GOPATH/src/github.com:$GOPATH/src/golang.org/x
更快:export CDPATH=.:$GOPATH/src/github.com:$GOPATH/src/golang.org/x
表示您可以键入cd net/html
而不是cd $GOPATH/src/golang.org/x/net/html
。Keith Rarick 指出,您可以设置
GOPATH=$HOME
,将Go的src/
,pkg/
和bin/
目录放在您的homedir下。 这可能很好(例如,您的路径中可能已经有$HOME/bin
),但当然有些人使用多个工作空间等。[Update: as of Go 1.8,
GOPATH
defaults to$HOME/go
, but you may still find this useful if you want to understand theGOPATH
layout, customize it, etc.]The official Go site discusses GOPATH and how to lay out a workspace directory.
export GOPATH="$HOME/your-workspace-dir/"
-- run it in your shell, then add it to~/.bashrc
or equivalent so it will be set for you in the future. Go will install packages undersrc/
,bin/
, andpkg/
, subdirectories there. You'll want to put your own packages somewhere under$GOPATH/src
, like$GOPATH/src/github.com/myusername/
if you want to publish to GitHub. You'll also probably wantexport PATH=$PATH:$GOPATH/bin
in your.bashrc
so you can run compiled programs under$GOPATH
.Optionally, via Rob Pike, you can also set
CDPATH
so it's faster tocd
to package dirs in bash:export CDPATH=.:$GOPATH/src/github.com:$GOPATH/src/golang.org/x
means you can just typecd net/html
instead ofcd $GOPATH/src/golang.org/x/net/html
.Keith Rarick notes you can set
GOPATH=$HOME
to put Go'ssrc/
,pkg/
andbin/
directories right under your homedir. That can be nice (for instance, you might already have$HOME/bin
in your path) but of course some folks use multiple workspaces, etc.
相关问答
更多-
gopath已经设置了.怎么还提示$GOPATH not set[2022-09-22]
不要用 sudo ,OS X 下我一般是直接在当前目录下用的,不设置 GOPATH ,现用现设。 $ GOPATH=`pwd` go get github.com/revel/revel -
从Go 1.8开始,默认的GOPATH值是/ go。 GOPATH是你的源代码将会存在的地方。 您可以使用默认的或使用自定义的,例如,我使用D:\ go。 IDE没有检测到GOPATH,因为没有设置。 当你下载Go时,你也会看到安装说明,请看看这个。 As of Go 1.8, the default GOPATH value is /go. GOPATH is where your source code will live. You can either use the default one or u ...
-
窗口中的GOPATH错误“GOPATH条目是相对的;(GOPATH error in windows “GOPATH entry is relative; must be absolute path: ”)[2024-02-25]
碰到同样的问题。 修复很简单:只需在整个路径名前面指定驱动器即可。 发生此问题是因为我按照Go“入门”页面上的说明进行操作,并设置了GOPATH=%HOMEPATH%\Work 。 问题在于%HOMEPATH%被定义为相对路径( \Users\MyName ),因此GOPATH现在指向\Users\MyName\Work 。 我需要做的就是设置GOPATH=c:\Users\MyName\Work并且错误消失。 Ran into same problem. Fix is quite simple: just ... -
[更新:从Go 1.8开始, GOPATH默认为$HOME/go ,但如果您想了解GOPATH布局,自定义等等,您可能仍然会发现这有用) 官方Go站点讨论了GOPATH以及如何布局工作区目录 。 export GOPATH="$HOME/your-workspace-dir/" - 在shell中运行它,然后将其添加到~/.bashrc或等效项,以便将来会为您设置。 Go将在src/ , bin/和pkg/下安装包。 如果您想发布到GitHub,您可以将自己的软件包放在$GOPATH/src之下,如$GOP ...
-
更新,从Go 1.8开始 :如果要安装Go 1.8(发布:2017年2月)或更高版本,则由GO工具链自动确定 GOPATH。 它默认为$HOME/go on macOS(nee OS X) - 例如/Users/matt/go/ 。 这使得开始使用Go更加容易,您可以在安装Go后立即go get
。 对于shell :(手动方法) 〜/ .bash_profile应该包含export GOPATH=$HOME/go并且还export PATH=$GOPATH/bin:$PATH 。 使用 ... -
只要编译器知道在哪里找到它,$ GOPATH就可以是你选择的任何位置(除了少数例外)。 如果您更改它,请确保使用更新路径 export GOPATH=/path/to/gopath 我个人的偏好是保持$ GOPATH与我的代码分开,除非我正在编写一个意图通过go get
导入的包,在这种情况下我将编写代码 $GOPATH/src/ 当你使用go get 时,这是包存储的标准位置 $GOPATH can really be any locati ... -
sudo go get github.com/go-sql-driver/mysql 这个运行在root用户下运行,没有设置$GOPATH 。 做就是了: go get github.com/go-sql-driver/mysql 一般来说,做: go get 在项目文件夹中,它将安装所有依赖项。 以下将安装测试中提到的依赖项: go get -t sudo go get github.com/go-sql-driver/mysql This runs go get under root user ...
-
正如上述评论者所说,你不应该使用sudo和go get 。 当您这样做时,您拥有root用户的环境(没有您的GOPATH),并且您创建的任何文件或目录都不会被您的用户编辑。 在过去, go get命令不会警告没有$GOPATH ,因此更容易被这个绊倒。 要修复权限,请运行以下命令将所有权更改回用户: sudo chown -R "$USER:" "$GOPATH" 您应该只需要运行一个普通的go get因为您可以(并且应该)将$GOPATH设置$GOPATH您可以控制的目录。 请务必阅读如何编写Go代码 ...
-
(2018年第二季度: 请注意,对于vgo项目 , GOPATH最终可能会被弃用,以支持基于项目的工作流。 这将避免GOPATH我在下面提出的基于项目的手动GOPATH ) 2016年6月:您不必仅依赖一个GOPATH (即一个工作区 )。 我的完整GOPATH包括: 一个全局路径(对于所有实用程序,如goimports ), github.com/smartystreets/goconvey $HOME/go github.com/smartystreets/goconvey $HOME/go githu ...
-
事实证明,去检查文件“src / cmd / go / alldocs.go”以验证路径是goroot。 我打开了一个关于积极检查的问题 ,但它以“无法修复”的方式关闭。 至少它可以使用不同的错误消息,但这就是今天的工作方式 As it turns out, go get checks for the file "src/cmd/go/alldocs.go" to verify that the path is goroot. I opened an issue about the aggressive c ...