Skip to content

Instantly share code, notes, and snippets.

@lifuzu
Created December 15, 2013 04:14
Show Gist options
  • Save lifuzu/7968787 to your computer and use it in GitHub Desktop.
Save lifuzu/7968787 to your computer and use it in GitHub Desktop.
Renaming files
//Renaming files using regular expressions
task rename(type: Copy) {
from 'source'
into 'dest'
rename(/file-template-(\d+)/, 'production-file-$1.txt')
}
//Renaming files programmatically
task rename(type: Copy) {
from 'source'
into 'dest'
rename { fileName ->
"production-file${(fileName - 'file-template')}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment