Creating folder in multi project

I have a project with such structure:
[ROOT]
[A]
[B]

[X]
gradle.settings

includeFlat 'A','B',...,'X'

In [A] and [B] subprojects i have task:

task build << {
    new File('target').mkdir()
}

When I call this task from subprojects everything is ok. Target folder is created in subproject folder.
But when I do call from [ROOT] project:

task buildAll {
    dependsOn subprojects.findAll().collect { subproject -> "${subproject.getPath()}:build" }
}

target folder is created in [ROOT] directory.
Could you please help me with this? Maybe there is another possibility to run subproject tasks?

org.gradle.api.Project 
File file(Object path)

did the trick