# Python script to count the number of different resource types in a set of project files

**URL:** <https://forum.inductiveautomation.com/t/python-script-to-count-the-number-of-different-resource-types-in-a-set-of-project-files/19256>\
**Category:** Ignition\
**Created:** [August 14, 2018, 10:05pm UTC](https://forum.inductiveautomation.com/t/python-script-to-count-the-number-of-different-resource-types-in-a-set-of-project-files/19256 "2018-08-14T22:05:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fourmajor](https://avatars.discourse-cdn.com/v4/letter/f/898d66/32.png) [@fourmajor](https://forum.inductiveautomation.com/u/fourmajor)\
**Post date:** [August 14, 2018, 10:05pm UTC](https://forum.inductiveautomation.com/t/python-script-to-count-the-number-of-different-resource-types-in-a-set-of-project-files/19256/1 "2018-08-14T22:05:46Z")

</div>

Just in case anyone else finds this of use! This Python script counts the number of different resource types in a set of project files:

```auto
from os import listdir
import pprint
import xml.etree.ElementTree as ET
folder = '/base/folder/here'
resource_dict = {}

for project_file in listdir(folder):
	elements = ET.parse('{}/{}'.format(folder, project_file)).getroot().find('resources').findall('resource')
	for element in elements:
		resource_type = element.attrib['type']
		if resource_type in resource_dict:
			resource_dict[resource_type] += 1
		else:
			resource_dict[resource_type] = 1
pp = pprint.PrettyPrinter(indent = 2)
pp.pprint(resource_dict)

```
