Extract filename extension from path