我的代碼只刪除文件中解析爲Jenkins名稱的文件。我想在上次提交中刪除基於作者(Jenkins)的文件。什麼是最好的解決方案?在提交中刪除基於作者姓名的文件
def changelogPath = "C:\\test"
def PackID = "test"
def delete(String changelogPath, String PackID) {
String folderPath = "$changelogPath"+ "\\" + "$PackID"
new File(folderPath).eachFile(FileType.FILES) { file ->
if (file.name.contains('Jenkins')) file.delete()
}
delete(changelogPath, PackID)
檢查這個帖子 - https://stackoverflow.com/questions/23151837/get-file-owner-metadata-information-with-java – Rao