I have to find 1 file (say "mysetting.xml" ) in every volume of Machine using cocoa ..... i wrote 1 recursive function scanPath to scan the harddisk but its taking long file (may b its going in indefinate loop )
I m calling this function
like this
so , how to find the files in cocoa in faster way
Also, when we type anything to find in finder , it returns within seconds .....
so is there any index of all the files which i can use to acess the file
Code:
-(void)scanPath:(NSString *)m_szPath
{
NSFileManager *flManager = [NSFileManager defaultManager];
BOOL isDir;
[flManager fileExistsAtPath:m_szPath isDirectory:&isDir];
if(isDir)
{
//directory related code here
NSArray *ContentOfDirectory=[flManager contentsOfDirectoryAtPath:m_szPath error:NULL];
int contentcount=[ContentOfDirectory count];
int i;
for(i=0;i<contentcount;i++)
{
NSString *fileName=[ContentOfDirectory objectAtIndex:i];
NSString *path=[m_szPath stringByAppendingFormat:@"%@%@",@"/",fileName];
if([flManager isDeletableFileAtPath:path])
{
NSLog(path);
[self scanPath:path];
}
}
}
else
{
//file related code here
NSString *msg=[NSString stringWithFormat:@"%@%@",@" -File ",[m_szPath lastPathComponent]];
NSLog(msg);
}
}
I m calling this function
like this
Code:
[self scanPath:@"/"];
so , how to find the files in cocoa in faster way
Also, when we type anything to find in finder , it returns within seconds .....
so is there any index of all the files which i can use to acess the file