//Declared in main class ---- CMyclass.h
RArray iFileList;
RArray iDirList;
//
_LIT(KFileExtension,"mp3");
_LIT(KDirPath,"c:\\Nokia\\Sounds\\Digital\\");
void CMyclass::ListDirectory( )
{
CDir* dirs = 0;
CDir* files = 0;
User::LeaveIfError(iFsSession.GetDir(KDirPath,KEntryAttNormal,ESortByName,files, dirs));
TFindFile FindFiles(iFsSession());
TInt err = FindFiles.FindWildByDir(KFileExtension,KDirPath, files);
CleanupStack::PushL(dirs);
CleanupStack::PushL(files);
//get files in base path
While (err == KErrNone)
{
for( TInt i=0; iCount(); i++ )
{
iFileList.Append( (*files)[i] );
iDirList.Append(KDirPath );
}
err = file_finder.FindWild(file_list);
CleanupStack::PopAndDestroy( 2 );
}
}
now the iFileList containes the file of desired extension
No comments:
Post a Comment