S3Cmd ignore file type

Posted February 16, 2018 2.9k views
CentOSDigitalOceanObject Storage

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.

edited by moisey

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

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.