Hello H.,
To achieve this `Expansion node and Loop node`:

Source:
You can use expansionInput/Output as (here is an attempts...):
@startuml
mainframe act FolderDocumentER
state Folder {
state "<<iterative>>" as fi <<expansionInput>>
state "Folder" as fo <<expansionOutput>>
state Document {
state "<<iterative>>" as di <<expansionInput>>
state "Document" as do <<expansionOutput>>
state c1 <<choice>>
state c2 <<choice>>
state x : Action X
di --> c1
c1 -r-> x : [Document invalid]
c1 --> c2 : [Document valid]
x --> c2
c2 --> do
do --> fo
}
}
[*] --> fi
fi --> di
fo --> [*]
@enduml

See also doc. here:
If that can help,
Regards,
Th.