Windows 中的 AWS Cli 不会将文件上传到 s3 存储桶

pmp*_*pjr 3 amazon-s3 amazon-web-services aws-cli

安装了 python 2.7.10 和 aws cli 工具的 Windows 服务器 12r2。以下工作:

aws s3 cp c:\a\a.txt s3://path/
Run Code Online (Sandbox Code Playgroud)

我可以毫无问题地上传该文件。我想要做的是将文件从映射驱动器上传到 s3 存储桶,因此我尝试了以下操作:

aws s3 cp s:\path\file s3://path/
Run Code Online (Sandbox Code Playgroud)

它有效。

现在我想要做但无法弄清楚的是如何不指定,但让它抓取所有文件,以便我可以安排它以将目录的内容上传到我的 s3 存储桶。我试过这个:

aws s3 cp "s:\path\..\..\" s3://path/ --recursive --include "201512"
Run Code Online (Sandbox Code Playgroud)

我收到此错误“参数太少”

最近我能猜到这很疯狂,我没有把特定的文件发送出去,但我不想这样做,我想自动化所有的事情。

如果有人可以请阐明我所缺少的东西,我将不胜感激。

谢谢

Cas*_*ita 5

如果这对我之后的其他人有用:在源和目标之间添加一些额外的空格。我一直反对使用单引号、双引号、斜杠等的每种组合运行此命令:

aws s3 cp /home/<username>/folder/ s3://<bucketID>/<username>/archive/ --recursive --exclude "*" --include "*.csv"
Run Code Online (Sandbox Code Playgroud)

它会给我:“aws:错误:参数太少”每个。单身的。道路。我试过。

所以终于看到了 --debug 选项,aws s3 cp help 所以再次以这种方式运行:

aws s3 cp /home/<username>/folder/ s3://<bucketID>/<username>/archive/ --recursive --exclude "*" --include "*.csv" --debug
Run Code Online (Sandbox Code Playgroud)

这是相关的调试行:

MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['s3', 'cp', 'home/<username>/folder\xc2\xa0s3://<bucketID>/<username>/archive/', '--recursive', '--exclude', '*', '--include', '*.csv', '--debug']
Run Code Online (Sandbox Code Playgroud)

我不知道\xc2\xa0源和目标之间是从哪里来的,但它就在那里!更新了该行以添加几个额外的空格,现在它可以正常运行:

aws s3 cp /home/<username>/folder/   s3://<bucketID>/<username>/archive/ --recursive --exclude "*" --include "*.csv" 
Run Code Online (Sandbox Code Playgroud)