Equals will check if the attributes only has the FILE_ATTRIBUTE_DIRECTORY bit set. The and operator will check if the FILE_ATTRIBUTE_DIRECTORY bit is set regardless of the other bits returned by GetFileAttributes().