我想在 jenkins 中使用 groovy 将 lastModified() json 重命名为文件名+“处理”。我没有成功地做:
JSON_BASE_PATH="/json_repo/"
def file = new File(JSON_BASE_PATH).listFiles()?.sort { it.lastModified() }?.find{it=~/.json$/}
file.renameTo( new File( file.getName() + ".processing") )
print "Filename is : " + file
Run Code Online (Sandbox Code Playgroud)
如何重命名?