s3-sync-action icon indicating copy to clipboard operation
s3-sync-action copied to clipboard

Ignore certain files and directories

Open FanciestW opened this issue 6 years ago โ€ข 7 comments

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!

FanciestW avatar Oct 03 '19 23:10 FanciestW

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 ๐Ÿ˜„

FanciestW avatar Oct 04 '19 01:10 FanciestW

You can ignore directories using the exclude option in args

with:
   args: --acl public-read --follow-symlinks --delete --exclude 'uploads/*'

EdwardHoward avatar Oct 04 '19 04:10 EdwardHoward

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. ๐Ÿ˜Š

jakejarvis avatar Oct 24 '19 18:10 jakejarvis

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

jcharnley avatar Apr 28 '20 11:04 jcharnley

Just be careful with the " ". Always use ' 'in the args flag.

andre-lx avatar Mar 04 '21 15:03 andre-lx

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

joeljacob93 avatar Mar 30 '23 22:03 joeljacob93