List folder/files on windows

79 views
Skip to first unread message

Deepak Gowda

unread,
Feb 2, 2021, 6:13:37 AM2/2/21
to Ansible Project
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

Stefan Hornburg (Racke)

unread,
Feb 2, 2021, 6:43:00 AM2/2/21
to ansible...@googlegroups.com
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

> Thanks
> Deepak
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d7027f1c-152e-4818-bc48-9df08df8de47n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d7027f1c-152e-4818-bc48-9df08df8de47n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages