Skip to content

Instantly share code, notes, and snippets.

@rotty3000
Created April 24, 2017 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rotty3000/0c0f0aa152214b4decb8ad8fb5142192 to your computer and use it in GitHub Desktop.
Save rotty3000/0c0f0aa152214b4decb8ad8fb5142192 to your computer and use it in GitHub Desktop.
gradle flatten while copy
/*
Where:
origin/
├── foo
│   └── fum.txt
├── bar
│   └── other.txt
└── biz
   └── baf
   └── bop
   └── default.properties
And desired result is:
destination/
└── sub
   ├── fum.txt
   ├── other.txt
   └── default.properties
*/
task copyFile(type: Copy) {
from "origin"
into "destination"
include 'foo/fum.txt', 'bar/other.txt', 'biz/baf/bop/default.properties'
eachFile { fcd ->
fcd.path = "sub/${cfd.name}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment