我必须将文件从一个s3桶复制到另一个桶。源桶中有许多文件夹,我们只能从每个文件夹中选择一个文件。下面是样本结构-
s3://mysrcbucket/CustomerID1/File1
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File1
s3://mysrcbucket/CustomerID2/File2
s3://mysrcbucket/CustomerID2/File3我已经准备了一个清单列表(将在s3distcp中使用),它保存了我需要为每个客户复制的文件的名称,例如-
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File3由于每个客户只需要复制一个文件,因此目标文件名应该转换为相应的customerID。就像-
Expected Result
s3://mytrgtbucket/CustomerID1 (this will hold the content of file-CustomerID1/File2)
s3://mytrgtbucket/CustomerID2 (this will hold the content of file-CustomerID2/File3)我在这里使用groupby子句,我可以用客户ID创建文件,但是它用CustomerID创建了另一个文件夹,例如-
Current Result
s3://mytrgtbucket/CustomerID1/CustomerID1
s3://mytrgtbucket/CustomerID2/CustomerID2.我用的命令是-
s3-dist-cp --src=s3://mysrcbucket/ --dest=s3://mytrgtbucket/ --copyFromManifest --previousManifest=s3://mysrcbucket/manifest.gz --groupBy='.*(CustomerID\d)/.*'是否可以做些什么来实现预期的结果,而不是当前的结果。
发布于 2017-10-29 18:54:41
我通过修改清单文件使其工作。
早期版本-
{"path":"s3://mytrgtbucket/CustomerID1/File2.txt","srcDir":"s3://mytrgtbucket/"}
{"path":"s3://mytrgtbucket/CustomerID2/File3.txt","srcDir":"s3://mytrgtbucket/"}工作版本-
{"path":"s3://mytrgtbucket/CustomerID1/File2.txt","srcDir":"s3://mytrgtbucket/CustomerID1/"}
{"path":"s3://mytrgtbucket/CustomerID2/File3.txt","srcDir":"s3://mytrgtbucket/CustomerID2/"}https://stackoverflow.com/questions/47003195
复制相似问题