【问题标题】:Copy multiple files from hadoop to s3 bucket将多个文件从 hadoop 复制到 s3 存储桶
【发布时间】:2019-08-27 04:11:26
【问题描述】:

我在 Hadoop 目录中有几个文件。我正在尝试将文件从 hadoop 目录复制到 s3 存储桶。

文件列表

sample1.txt

sample2.txt

sample3.txt

我想一次复制所有文件

 aws s3 cp *.txt s3://bucket-name/samples/

显示错误

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]

【问题讨论】:

    标签: amazon-web-services hadoop amazon-s3


    【解决方案1】:

    你可以这样做:

    aws s3 cp . s3://<bucket-name> --recursive --exclude "*" --include "*.txt"
    aws s3 cp <Hadoop-Dir-Path> s3://<bucket-name> --recursive --exclude "*" --include "*.txt"
    

    或者你也可以使用同步:

    aws s3 sync . s3://<bucket-name> --exclude "*" --include "file.*"
    

    请注意,默认情况下,所有文件都包含在内。这意味着仅提供 --include 过滤器不会更改传输的文件。 --include 只会重新包含已从 --exclude 过滤器中排除的文件。如果您只想上传具有特定扩展名的文件,则需要先排除所有文件,然后重新包含具有特定扩展名的文件。此命令将仅上传以 .txt 结尾的文件。

    AWS Documentation

    AWS Documenation for sync

    【讨论】:

      猜你喜欢
      • 2017-11-23
      • 2016-10-27
      • 1970-01-01
      • 2019-08-07
      • 1970-01-01
      • 2013-11-01
      • 2020-07-05
      • 2018-11-22
      • 1970-01-01
      相关资源
      最近更新 更多