user773578
user773578

Reputation: 1161

Check if a file exists in the documents directory

How can one check if a file exists in the documents directory by a specific name?

Upvotes: 2

Views: 1096

Answers (3)

Radix
Radix

Reputation: 3657

BOOL result = [[NSFileManager defaultManager] fileExistsAtPath:fileLocationofDocumentDirectory];

if(result ==YES)
{
NSLog(@"File present");
}
else
{
NSLog(@"File Not present");
}

Upvotes: 4

Jhaliya - Praveen Sharma
Jhaliya - Praveen Sharma

Reputation: 31722

BOOL isMyFileThere = [[NSFileManager defaultManager] fileExistsAtPath:myFilePath];

Check in NSFileManager Documentation .

Upvotes: 9

Related Questions