Use yield instead of creating temporary lists

Signed-off-by: Raul Gutierrez S <rgs@itevenworks.net>
Support copying only max_items in cp

Signed-off-by: Raul Gutierrez S <rgs@itevenworks.net>