# Question about with\_items after running a find

**URL:** <https://forum.ansible.com/t/question-about-with-items-after-running-a-find/22322>\
**Category:** Ansible Project\
**Created:** [August 18, 2016, 7:45pm UTC](https://forum.ansible.com/t/question-about-with-items-after-running-a-find/22322 "2016-08-18T19:45:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Leo\_Huetter](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@John\_Leo\_Huetter](https://forum.ansible.com/u/John_Leo_Huetter)\
**Post date:** [August 18, 2016, 7:45pm UTC](https://forum.ansible.com/t/question-about-with-items-after-running-a-find/22322/1 "2016-08-18T19:45:50Z")

</div>

Hello, I am running a find and then working on each item, like:

- name: “Finding …”  
find: paths=“/app” pattern=“{{ pattern }}” recurse=yes get\_checksum=yes  
changed\_when: False  
register: find\_results

- name: “Display files which were matched …”  
debug: var=item.path  
with\_items: find\_results.files

When I run this, I see a dump of the item var TWICE, as well as the item.path I am searching for. See below (masked out our files names). I am not debugging that if I was I would just say debug: var=item.  
I just want to see a nice list of all the files found but the output for the debug: var is also jumping the whole “item” data structure.

Next, I want to take all the item.paths found and POPULATE a new list of just the files.

Any suggestions for A) why is debug var=item.path printing out all of item as well, and B) how can I just get a list of files.

ok: [hostA] =\> (item={u’uid’: 7052, u’woth’: False, u’mtime’: 1243008168.0, u’inode’: 786726, u’isgid’: False, u’size’: 84, u’roth’: False, u’isuid’: False, u’isreg’: True, u’gid’: 7052, u’ischr’: False, u’wusr’: True, u’xoth’: False, u’rusr’: True, u’nlink’: 1, u’issock’: False, u’rgrp’: True, u’path’: u’\<file\_path\>‘, u’xusr’: False, u’atime’: 1471056911.3219833, u’isdir’: False, u’ctime’: 1393634477.6260712, u’isblk’: False, u’xgrp’: False, u’dev’: 64768, u’wgrp’: False, u’isfifo’: False, u’mode’: u’0640’, u’checksum’: u’ceed0ec81c110f5107306d3d56de879d255c8bef’, u’islnk’: False}) =\> {  
“item”: {  
“atime”: 1471056911.3219833,  
“checksum”: “ceed0ec81c110f5107306d3d56de879d255c8bef”,  
“ctime”: 1393634477.6260712,  
“dev”: 64768,  
“gid”: 7052,  
“inode”: 786726,  
“isblk”: false,  
“ischr”: false,  
“isdir”: false,  
“isfifo”: false,  
“isgid”: false,  
“islnk”: false,  
“isreg”: true,  
“issock”: false,  
“isuid”: false,  
“mode”: “0640”,  
“mtime”: 1243008168.0,  
“nlink”: 1,  
“path”: “\<file\_path\>”,  
“rgrp”: true,  
“roth”: false,  
“rusr”: true,  
“size”: 84,  
“uid”: 7052,  
“wgrp”: false,  
“woth”: false,  
“wusr”: true,  
“xgrp”: false,  
“xoth”: false,  
“xusr”: false  
},  
“item.path”: “\<file\_path\>”  
}

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 18, 2016, 8:53pm UTC](https://forum.ansible.com/t/question-about-with-items-after-running-a-find/22322/2 "2016-08-18T20:53:35Z")

</div>

> Hello, I am running a find and then working on each item, like:
> 
> &nbsp;&nbsp;- name: "Finding ..."  
> &nbsp;&nbsp;&nbsp;&nbsp;find: paths="/app" pattern="{{ pattern }}" recurse=yes get\_checksum=yes  
> &nbsp;&nbsp;&nbsp;&nbsp;changed\_when: False  
> &nbsp;&nbsp;&nbsp;&nbsp;register: find\_results
> 
> &nbsp;&nbsp;- name: "Display files which were matched ..."  
> &nbsp;&nbsp;&nbsp;&nbsp;debug: var=item.path  
> &nbsp;&nbsp;&nbsp;&nbsp;with\_items: find\_results.files
> 
> When I run this, I see a dump of the item var TWICE, as well as the  
> item.path I am searching for. See below (masked out our files names). I am  
> not debugging that if I was I would just say debug: var=item.  
> I just want to see a nice list of all the files found but the output for  
> the debug: var is also jumping the whole "item" data structure.

I guess that's because debug is made for debug and not nice reporting.  
You could use my suggestion bellow in a '- debug: msg=""'

> Next, I want to take all the item.paths found and POPULATE a new list of  
> just the files.

{{ find\_results.files | map(attribute='path') | list }}
