It is usually best to search for the files first, building a list in-memory of the things to be removed, then to separately remove those items. File searches often get confused if the directory structure they're traversing changes beneath their feet.