MathieuLoutre / grunt-aws-s3

Grunt plugin to interact with AWS S3 using the AWS SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copy single file?

MMRandy opened this issue · comments

I don't see an easy way to copy a single file given that the src attribute will be used as a prefix for the destination file. Am I missing something here? Trying the following cmd:

                backup: {
                    files:[
                        {src: 'xxx/js/yyy.js', dest: 'xxx/js/zzz.js', action: 'copy'},
                    ]
                },

What happens when you do this? It gets created but using the whole of src as the path?
The copy action is pretty new in the plugin and I haven't used it much myself, but what you describe should be possible. Unless I'm mistaken, the src attribute is used a prefix when listing data, it shouldn't be (I think) used when copying the data. Let me know if I'm wrong.

Otherwise, and it's a little bit of a workaround, you could use exclude to match the one file you want with flipExclude to true to make sure it only matches this one file.

If no src is specified, it'll throw for copy commands:

Fatal error: Specify a "src" but not a "cwd" for copies

And the exclude with the flipExclude set to true will experience the same result, namely that the src file (whether from the src arrib or the result of the exclude and flip) will be appended to the dest attrib and saved as the copied filename. Seems like a bug but haven't dug into the code.

Oooh, I get it. I didn't think you'd want to change the name of the file as it's copied

Not sure how to do it right now but this should be supported I guess.

On Sat, Mar 7, 2015 at 9:38 PM, MMRandy notifications@github.com wrote:

If no src is specified, it'll throw for copy commands:

Fatal error: Specify a "src" but not a "cwd" for copies

And the exclude with the flipExclude set to true will experience the same result, namely that the src file (whether from the src arrib or the result of the exclude and flip) will be appended to the dest attrib and saved as the copied filename. Seems like a bug but haven't dug into the code.

Reply to this email directly or view it on GitHub:
#63 (comment)

Duplicate of #68. Closing for now, discussion will continue on other issue.