s3-sync-action
s3-sync-action copied to clipboard
Ignore certain files and directories
Hello, great action by the way. I am a fan! Is there a way to ignore certain files or directories if I specify a source directory that includes some files that I don't want to sync with my S3 bucket?
Thank you!
Just realized I should be a directory called dist/ or public/ and target that directory as my SOURCE_DIR. But I would love to know if there is a way to ignore files using glob patterns and if not, it would be a great feature ๐
You can ignore directories using the exclude option in args
with:
args: --acl public-read --follow-symlinks --delete --exclude 'uploads/*'
So sorry for the late reply @FanciestW and thanks for the kind words! @EdwardHoward is correct, this is how I would do it too โย you can also exclude multiple files/folders by simply having multiple --exclude flags (aka only one pattern per --exclude). There's an --include option too if you'd like to accomplish this the opposite way.
There are a ton of arguments for the CLI that I'd rather leave up to the CLI rather than re-inventing the wheel within this action. But let me know if this works for you before I close this. ๐
how do you exclude .git and .github files on upload to s3. I have them ignored locally ".gitingore" too.
Tried --exclude but doesnt seem to do what i want it to do
Just be careful with the " ". Always use ' 'in the args flag.
@jakejarvis is there a way to ignore the source directory structure and not replicate it in the destination? What can flag can I use here for that? aws s3 sync command doesn't have an option to flatten the directory structure.
args: --acl public-read --follow-symlinks --exclude '*' --include 'file.txt' --include 'folder1/subfolder/**' --exclude '.git*/*'
Would appreciate any help here.