Use FileType function to determine filetype