排除 s3cmd 同步的文件夹 [英] Exclude folders for s3cmd sync

查看:23
本文介绍了排除 s3cmd 同步的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 s3cmd,我想知道如何排除存储桶中的所有文件夹并同步存储桶根目录.

I am using s3cmd and i would like to know how to exclude all folders within a bucket and just sync the bucket root.

例如

bucket
folder/two/
folder/two/file.jpg
get.jpg

通过同步,我只希望它同步 get.jpg 并忽略文件夹及其内容.

with the sync i just want it to sync the get.jpg and ignore the folder and its contents.

s3cmd --config sync s3://s3bucket (only sync root) local/

如果有人可以提供帮助,那就太棒了,我已经尝试过 --exclude 但不确定如何在这种情况下使用它?

If someone could help that would be amazing i have already tried the --exclude but not sure how to use it in this situation?

推荐答案

您确实应该使用 --exclude 选项.如果你想同步根目录上的每个文件而不是文件夹,你应该尝试:

You should indeed use the --exclude option. If you want to sync every file on the root but not the folders, you should try :

s3cmd --exclude="/*/*" sync local/ s3://s3bucket

请记住,S3 上实际上并不存在文件夹.文件夹 folder 中的文件 file 似乎只是一个名为 folder/file 的文件!所以你只需要排除带有 /*/* 模式的文件.

Keep in mind that a folder doesn't really exist on S3. What seems to be a file file in a folder folder is just a file named folder/file! So you just have to exclude file with the pattern /*/*.

这篇关于排除 s3cmd 同步的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆