# GFileUtils

open class GFileUtils(source)

### Deprecated

This class is only here to maintain binary compatibility with existing plugins.

Plugins should prefer java.io, java.nio or external packages over this class.

#### Deprecated

Will be removed in Gradle 9.0.

## Constructors

GFileUtils
Link copied to clipboard
constructor()

## Types

TailReadingException
Link copied to clipboard
open class TailReadingException : RuntimeException
Tail reading exception.

## Functions

checksum
Link copied to clipboard
open fun checksum(file: File, checksum: Checksum): Checksum
copyDirectory
Link copied to clipboard
open fun copyDirectory(source: File, destination: File)
copyFile
Link copied to clipboard
open fun copyFile(source: File, destination: File)
If the destination file exists, then this method will overwrite it.
copyURLToFile
Link copied to clipboard
open fun copyURLToFile(source: URL, destination: File)
deleteDirectory
Link copied to clipboard
open fun deleteDirectory(directory: File)
deleteQuietly
Link copied to clipboard
open fun deleteQuietly(@Nullable file: File): Boolean
forceDelete
Link copied to clipboard
open fun forceDelete(file: File)
listFiles
Link copied to clipboard
open fun listFiles(directory: File, extensions: Array<String>, recursive: Boolean): Collection<File>
mkdirs
Link copied to clipboard
open fun mkdirs(dir: File)
Like mkdirs, except throws an informative error if a dir cannot be created.
moveDirectory
Link copied to clipboard
open fun moveDirectory(source: File, destination: File)
moveExistingDirectory
Link copied to clipboard
open fun moveExistingDirectory(source: File, destination: File)
moveExistingFile
Link copied to clipboard
open fun moveExistingFile(source: File, destination: File)
moveFile
Link copied to clipboard
open fun moveFile(source: File, destination: File)
openInputStream
Link copied to clipboard
open fun openInputStream(file: File): FileInputStream
parentMkdirs
Link copied to clipboard
open fun parentMkdirs(child: File): File
Makes the parent directory of the file, and any non existent parents.
readFile
Link copied to clipboard
open fun readFile(file: File): String
open fun readFile(file: File, encoding: String): String
readFileQuietly
Link copied to clipboard
open fun readFileQuietly(file: File): String
Reads and returns file contents.
relativePathOf
Link copied to clipboard
open fun relativePathOf(target: File, base: File): String
Returns the path of target relative to base.
tail
Link copied to clipboard
open fun tail(file: File, maxLines: Int): String
Returns the tail of a file.
toPaths
Link copied to clipboard
open fun toPaths(files: Collection<File>): List<String>
touch
Link copied to clipboard
open fun touch(file: File)
Ensures that the given file (or directory) is marked as modified.
touchExisting
Link copied to clipboard
open fun touchExisting(file: File)
Ensures that the given file (or directory) is marked as modified.
writeFile
Link copied to clipboard
open fun writeFile(content: String, destination: File)
open fun writeFile(content: String, destination: File, encoding: String)