refactored out file globbing functionality from do