This message was deleted.
# community-support
s
This message was deleted.
v
In most situations you want
Sync
over
Copy
. It removes files it didn't copy there itself. The preserve afair is just to exclude some files from this cleaning, but not to not overwrite files.
But maybe you can use an
eachFile { ... }
closure where you check whether the target file exists and if so
exclude()
it or something like that.
s
Ahh okay, thanks I'll use the closure
weird..how do i get the right scope for the eachFile?
eachFile *{* file *->* file.exclude() *}*
build.gradle.kts:43:14: Type mismatch: inferred type is ([Error type: Cannot infer a lambda parameter type]) -> ??? but Closure<(raw) Any!>! was expected
ah, seems i can just use it as this scope. but, oddly the lambda variables behave weirdly here. i suppose it confuses gradle kts' inferencing, so i would need to somehow expliclty specify whatever type that is meh, i can just do it without file ->
it's even more weird because
it
is invalid. it doesn't auto generate the
it
like kotlin normally does?
v
All the Gradle actions use the sam-with-receiver plugin. So what you expect to be "it" is "this".
s
thanks, that's the term i forgot about, sam-with-receiver