I have an ItemGroup that contains some files (And I have no control on how this list is generated):
ItemGroup
You need to use item batching using the % instead of the @. This will work on the items one by one instead of including them all at the same time. You had the condition right, which I assume you found somewhere else.