Added _getFile and _isSingleFileMatchingRegex

Also fixed a dormant error in _getFolder and made it shorter.
Merge pull request #3438 from ussuri/new-utility-functions

Added _getFile and _isSingleFileMatchingRegex