I need to copy files under the list of directories to its corresponding directories in destination list. Say I have a list of source directories like 'A','B','C'
and a list of target directories like 'X','Y','Z'
. What I need to do is to copy files under A directory to be copied to X directory and from B to Y and C to Z. I have created a gradle task for this purpose. But I get an error
task copyDirs( ) {
def targetDirList = ['/target1', '/target2', '/target3'].toArray()
def sourceDirList = ['/source1', '/source2', '/source3'].toArray()
[sourceDirList,targetDirList].transpose().each {
copy{
from it[0].toString()
into it[1].toString()
}
}
}
And below is the exception I get when I try to execute it
No signature of method: org.gradle.api.internal.file.copy.CopySpecWrapper_Decorated.getAt() is applicable for argument types: (java.lang.Integer) values: [0]
Possible solutions: getAt(java.lang.String), putAt(java.lang.String, java.lang.Object), wait(), grep(), getClass(), wait(long)