Correction: File.lstat(file).ftype should be used instead.