# how to display sub variables using debug module

**URL:** <https://forum.ansible.com/t/how-to-display-sub-variables-using-debug-module/35427>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 28, 2021, 3:19pm UTC](https://forum.ansible.com/t/how-to-display-sub-variables-using-debug-module/35427 "2021-06-28T15:19:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Veliss](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@John\_Veliss](https://forum.ansible.com/u/John_Veliss)\
**Post date:** [June 28, 2021, 3:19pm UTC](https://forum.ansible.com/t/how-to-display-sub-variables-using-debug-module/35427/1 "2021-06-28T15:19:25Z")

</div>

I am using the win.find module along with the debug module to list files.

tasks:

- name: Find ALDM zip files  
ansible.windows.win\_find:  
paths: c:\temp  
recurse: no  
patterns: “\*.zip”  
register: files\_to\_copy
- debug:  
msg: “{{files\_to\_copy}}”

This is what I get

“msg”: {  
“changed”: false,  
“examined”: 13,  
“failed”: false,  
“files”: [  
{  
“attributes”: “Archive”,  
“checksum”: “2ac51252d04aa02addeda5a86270da2a925b13fc”,  
“creationtime”: 1624860215.3043969,  
“exists”: true,  
“extension”: “.zip”,  
“filename”: “xsapagos-xxstestwin-2106280603.zip”,  
“hlnk\_targets”: ,  
“isarchive”: true,  
“isdir”: false,  
“ishidden”: false,  
“isjunction”: false,  
“islnk”: false,  
“isreadonly”: false,  
“isreg”: true,  
“isshared”: false,  
“lastaccesstime”: 1624860215.6950212,  
“lastwritetime”: 1624860215.6950212,  
“lnk\_source”: null,  
“lnk\_target”: null,  
“nlink”: 1,  
“owner”: “BUILTIN\Administrators”,  
“path”: "C:\temp\ xsapagos-xxstestwin-2106280603.zip ",  
“sharename”: null,  
“size”: 24556  
},

How can I use debug to output just the filename

as I have tried the below

- debug:  
msg: “{{files\_to\_copy.files.filename}}”

But I get → {“msg”: "The task includes an option with an undefined variable. The error was: ‘dict object’ has no attribute ‘filename’\n\nThe error appears to be in

---

<div class="post-metadata">

**Author:** ![Clint\_Denham](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Clint\_Denham](https://forum.ansible.com/u/Clint_Denham)\
**Post date:** [June 28, 2021, 4:05pm UTC](https://forum.ansible.com/t/how-to-display-sub-variables-using-debug-module/35427/2 "2021-06-28T16:05:21Z")

</div>

Files is a list

“files”: [

So you need to reference which entry of the list you want to debug. For example…

files\_to\_copy.files.0.filename
