- shell: (cd /remote; find . -maxdepth 1 -type f) | cut -d'/' -f2 register: files_to_copy - fetch: src=/remote/{{ item }} dest=/local/ with_items: files_to_copy.stdout_lines