api / org.gradle.api / Project / delete

delete

abstract fun delete(vararg paths: Any): Boolean

Deletes files and directories.

This will not follow symlinks. If you need to follow symlinks too use #delete(Action).

Parameters

paths - Any type of object accepted by org.gradle.api.Project#files(Object...)

Return
true if anything got deleted, false otherwise

abstract fun delete(action: Action<in DeleteSpec>): WorkResult

Deletes the specified files. The given action is used to configure a DeleteSpec, which is then used to delete the files.

Example:

 project.delete { delete 'somefile' followSymlinks = true } 

Parameters

action - Action to configure the DeleteSpec

Return
WorkResult that can be used to check if delete did any work.