S3Cmd ignore file type

February 16, 2018 392 views
Object Storage DigitalOcean CentOS

I want to send lots of files to the spaces, however, I want to specify only a few file extensions.
I tried to use the "--include-from" pointing to a file with the list of extensions that I want to send but it does not respect the list and tries to send everything.

I searched but did not find any documentation on these specific parameters. Would there be any other way to send just a few specific extensions?

In the future I want to use sync to send only files that have changed from the same set of extensions.

2 Answers
asb MOD February 16, 2018
Accepted Answer

When you run s3cmd sync, it will try to sync all of the files in the directory that you pointed it at. Adding --include does not change that as the files you are including are already in the set of files being uploaded. --include does not imply that the other files are excluded. You must specify that. For example, if I only wanted to upload files with the extension png, I can use:

  • 3cmd sync --exclude="*" --include='*.png' path/to/local/dir s3://space-name

It worked.
The command worked exactly as I'd like.
Thanks a lot for the help.

Have another answer? Share your knowledge.