Instance Method

contentsEqualAtPath:andPath:

Returns a Boolean value that indicates whether the files or directories in specified paths have the same contents.

Declaration

- (BOOL)contentsEqualAtPath:(NSString *)path1 andPath:(NSString *)path2;

Parameters

path1

The path of a file or directory to compare with the contents of path2.

path2

The path of a file or directory to compare with the contents of path1.

Return Value

YES if file or directory specified in path1 has the same contents as that specified in path2, otherwise NO.

Discussion

If path1 and path2 are directories, the contents are the list of files and subdirectories each contains—contents of subdirectories are also compared. For files, this method checks to see if they’re the same file, then compares their size, and finally compares their contents. This method does not traverse symbolic links, but compares the links themselves.

See Also

Related Symbols

- contentsAtPath:

Returns the contents of the file at the specified path.