import java.io.FileOutputStream import java.io.FileWriter plugins { id("base") id ("java") } tasks.create("copy") { description = "'src'의 파일들을 'dest'로 복사" group = "my tasks" from("src") { include("**/*.txt") } from("src2") { exclude("**/*.tmp") } into("dest") includeEmptyDirs = false } tasks.create("delete") { description = "'dest'의 파일들을 삭제" group = "my tasks" delete("dest") delete("exec_result.txt") isFollowSymlinks = true } tasks.create("zip") { description = "Archive source files in a zip file." group = "my tasks" from("src") } tasks.create("execute") { description = "CLI 명령을 실행" group = "my tasks" workingDir = file(projectDir) commandLine = listOf("ls", "-al") // 표준 출력 대신 파일로 출력 standardOutput = FileOutputStream(file("exec_result.txt")) } tasks.create("sync") { description = "'src'의 파일들을 'dest'로 동기화" group = "my tasks" from("src") into("src2") preserve { include("*.txt") exclude("*.tmp") } }