Question: Hi I have this function:

```
changeTarea: function() {

    var self = this;
    $("#select_tarea_id").change(function() {
        var id_tarea = $("#select_tarea_id").val();

        $.each(self.objTareasFlot, function(index,value) {

            for(var i = 0; i < value.length; i++) {

                if(value[i].Id == id_tarea) {

                    self.objTareasFlotFinal['id']=value[i].Id;
                    self.objTareasFlotFinal['id_pro']=value[i].Id_proyecto;
                    self.objTareasFlotFinal['tarea']=value[i].nombre_tarea;
                    self.objTareasFlotFinal['porcentaje']=value[i].porcentaje;

                    console.info(self.objTareasFlotFinal);
                }
            }
       });

    });
}

```

And the function print : 

[![enter image description here](https://i.stack.imgur.com/hQ3aV.jpg)](https://i.stack.imgur.com/hQ3aV.jpg)

But I need the 3 results in one array

for example :

[![enter image description here](https://i.stack.imgur.com/ym2rj.jpg)](https://i.stack.imgur.com/ym2rj.jpg)

How can I do that with that function? Sorry for my english I did try to explain of the better way

Answer: 
With proper implementation, roll your own code™ give you flexibility over the shell copy. For example, it's easier to abort operation, and provide progress to user.

By the way, when you see Windows copying file fast - it's just perspective. File explorer queue the copy or otherwise do it in background. It takes about the same time with, e.g. [CopyFileEx](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363852(v=vs.85).aspx) or [sendfile](http://linux.die.net/man/2/sendfile) until the copy finish and the file is usable.
The reasons for not using shell to use basic tasks in the language are not related to performance at all - it's more about safety and portability. You wouldn't use `eval` in your language nor try to concatenate strings to create SQL queries - and yet there you are, creating shell commands by concatenating strings.

Brett Hale's "solution" conveniently doesn't mention all these and hides the code needed to make this safe and portable behind the comment "do it yourself" - in fact, when you do this you'll end up with more code than hand-rolled copy function and it'll still be buggy. And if you have a bug there, an user can inject commands (for example, run it with a destination file `a_file" || rm -rf --no-preserve-root`). Also you're relying on the shell, which itself can have bugs (see Shellshock)

Calvin's answer correctly mentions why the copy operation done by the shell may work faster - it can do more tricks to make it look like it copies faster. In fact, there is no inherent magic in the shell copy operations. The "performance problem" is not a problem since the main bottleneck is in actual reading and writing.

Furthermore, you present a false dichotomy, since you fail to consider using a third option: a third-party library. One of them is Boost.Filesystem, which has a copy function.