Created
October 10, 2010 16:00
-
-
Save masanobuimai/619348 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g100pon #28 ファイル名の一括置換 | |
// | |
import groovy.io.FileType | |
// 開始ディレクトリや探索方法は適当に直して | |
new File("../").eachFileRecurse(FileType.FILES) { file -> | |
// とりあえずファイル名を置換してみる(変換パターンも適当に直して) | |
def newFileName = file.name.replaceAll(/.class$/, ".clazz") | |
if (file.name != newFileName) { | |
// 置換できてれば、実ファイルをリネームする | |
def newFile = new File("${file.parentFile}${File.separator}${newFileName}") | |
println "$file >> $newFile" | |
file.renameTo(newFile) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment