I have a directory structure like this:
file1.txt file2.txt dir1/ file3.txt file4.txt
I want to use Gradle to copy the entire structure to another directory. I tried this:
task mytest << { copy { from "file1.txt" from "file2.txt" from "dir1" into "mytest" } }
But this leads to the following:
mytest/ file1.txt file2.txt file3.txt file4.txt
See, the copy from dir1 copied the files to dir1 , whereas I want to copy dir1 myself.
Is it possible to do this directly using Gradle copy ?
So far I have managed to find this solution:
task mytest << { copy { from "file1.txt" from "file2.txt" into "mytest" } copy { from "dir1" into "mytest/dir1" } }
For my simple example, there are not many, but in my actual case there are many directories that I want to copy, and I would not want to repeat so many.
source share