Fixed an issue with GetFiles

Fixed an issue where GetFiles was always checking if the specific target
was a directory rather than the actual directory. This was causing an empty array to always be returned.