S3Cmd ignore file type

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.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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:

  1. 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.