List folder/files on windows

HI All,

I have a list of files in C:\Users\xxxuser\Downloads\ ,I am trying to find out if i can pull the list of files/folders present in windows on the ansible node.

i have the below playbook which doesnt give any error nd doesn’t give me a list,

  • hosts: windows

tasks:

  • name: Find Files in Path

win_find:

paths: C:\Users\xxxuser\Downloads
age: 2h

Thanks
Deepak

HI All,

I have a list of files in C:\Users\xxxuser\Downloads\ ,I am trying to find out if i can pull the list of files/folders
present in windows on the ansible node.

i have the below playbook which doesnt give any error nd doesn't give me a list,

- hosts: windows

tasks:

- name: Find Files in Path

win\_find:

  paths: C:\\Users\\xxxuser\\Downloads\\
  age: 2h

Hello Deepak,

I think you need to register the results to see the list of files:

- name: Find Files in Path
  win_find:
    paths: C:\Users\xxxuser\Downloads\
    age: 2h
  register: xxx_downloads

- debug:
    msg: "{{ xxx_downloads.files }}"

Regards
        Racke