List directories recursively

The following groovy snippet lists all subdirectories of the current directory.
(more…)

List all directories with a specific name

This groovy snippet lists all directories named “bar” in the “test” directory.
(more…)

List files recursively

The following groovy example shows how to recursively list all *.txt files in a directory.
(more…)

Listing a directory the Java way

List the contents of a directory with groovy using the built in methods of Java. The groovy way is described in the following snippetsList files of a specific type, List directory contents and list files recursively.
(more…)

Count lines

Howto count all lines from stdin or a file in groovy.
(more…)

List directory contents with AntBuilder

This shows how to list the content of a directory with AntBuilder.
(more…)

Logging with groovy

Logging with groovy is as simple as this.
(more…)

Creating a Zipfile with AntBuilder

This is an example of the groovy antbuilder to create a zipfile.
(more…)

Printf in groovy

This shows you how to use the printf function in groovy to print a tic tac toe field like this:

   | x | o
---+---+---
   | x |
---+---+---
 o |   |

in stdout

(more…)

Determine the size of a file

The lengt function prints out the size of a file.

(more…)