Find and Fetch

Hi

I am using below code to find and fetch files from remote server to local, how ever its not erroring, but not fetch anything

  • find:
    paths=“/home/cloud-user”
    patterns=“*.tar”
    register: file_to_copy

  • fetch:
    src={{ item.path }}
    dest=/home/cloud-user/abscp
    with_items: “{{file_to_copy.files}}”

I have some files named abc.tar.gz, dba.tar.gz – what I am trying to find patter and copy all to local machine…

Can someone suggest what mistake i am doing here.

At first glance, your patterns seems to be missing a '.gz' after '.tar'. Do all files end in '.tar.gz'?

Can you try like this in your pattern “.tar