Skip to content

Commit

Permalink
Merge pull request #460 from krisdehe/deleteEmptyDirs_exception
Browse files Browse the repository at this point in the history
Added try catch in deleteEmptyDirsRecursively
  • Loading branch information
jfrogdixit authored Nov 27, 2024
2 parents 3909d97 + f9e2b18 commit 58058f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cleanup/deleteEmptyDirs/deleteEmptyDirs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ def deleteEmptyDirsRecursively(RepoPath path) {
if (repositories.getChildren(path).empty) {
// it is folder, and no children - delete!
log.info "Deleting empty directory($path)"
repositories.delete path

try {
repositories.delete path
} catch (Exception e) {
log.error "Failed to delete empty directory($path): $e.message"
}

deletedDirs += 1
}
}
Expand Down

0 comments on commit 58058f7

Please sign in to comment.