31 October 2005

Do action for all files in some directory on all drives in Symbian

In SDL there is a useful sample of how to run through all files in directory:


void ForAllMatchingFiles(RFs& aSession, const TDesC& aWildName, const TDesC& aScanDir)
{
TFindFile file_finder(aSession);
CDir* file_list;
TInt err = file_finder.FindWildByDir(aWildName,aScanDir, file_list);
while (err==KErrNone)
{
TInt i;
for (i=0; i < Count(); i++)
{
TParse fullentry;
fullentry.Set((*file_list)[i].iName, &file_finder.File(),NULL);

// Do something with the full Symbian OS filename

DoOneFile(aSession, fullentry.FullName());
}
delete file_list;
err=file_finder.FindWild(file_list);
}
}

No comments: