Minor refactoring in code that deletes files/folders.

A review comment was made in #263, but that pull request was closed, and the comment was not addressed in #265.

@JeffryBooher - please review.