I don't quite understand this. The main thing is that we're reading the same index from prunedFileList as well as origList. If I'm reading this right, the indices on prunedFileList has no relation with the indices on origList. You'd skip files from origList, so origList and pruneFileList would go out of sync in terms of their indices.

How would things like prunedFileList.get(i-1) be compared to fileName derived from origList[i]? I'm having trouble understanding that part. Likewise, how would prunedFileList.remove(i-1) line up correctly?

If you have more than one pair of files that are skipped in the middle, I suspect this would break pretty easily. Am I reading this right?