You can use the RDir class, to list all files and directories of a drive.
Then use RDir recursively for every directory you find, to list all files in it, and then go through the list to see if any of the listed files are mp3s.
// aPath of the Directory for which you are looking
CDirScan* DirScan = CDirScan::NewLC(aFs);
DirScan->SetScanDataL(aPath,KEntryAttDir|KEntryAttMatchExclusive,ESortNone, CDirScan::EScanDownTree);
while(true)
{
CDir* dir = NULL;
TRAPD(error, DirScan->NextL(dir));
if (error || !dir)
break;
delete dir;
scanFiles(RFs,aDir,_L(*.mp3));
};
scanFiles(RFs aFs,aDir,_L(*.mp3))
{
TParse parse;
parse.Set(aWild, &aDir, NULL);
TPtrC spec(parse.FullName());
TFindFile FindFile(aFs);
CDir* dir;
if(!FindFile.FindWildByPath(parse.FullName(), NULL, dir));
{
// Files Path
}
}
for better Understanding just go through the Documentation for CDirScan and TFindFile
Forum posts: 1134
You can use the RDir class, to list all files and directories of a drive.
Then use RDir recursively for every directory you find, to list all files in it, and then go through the list to see if any of the listed files are mp3s.
TFindFile is probably useful for you too
Forum posts: 54
here i am giving the Sample code
// aPath of the Directory for which you are looking
CDirScan* DirScan = CDirScan::NewLC(aFs);
DirScan->SetScanDataL(aPath,KEntryAttDir|KEntryAttMatchExclusive,ESortNone, CDirScan::EScanDownTree);
while(true)
{
CDir* dir = NULL;
TRAPD(error, DirScan->NextL(dir));
if (error || !dir)
break;
delete dir;
scanFiles(RFs,aDir,_L(*.mp3));
};
scanFiles(RFs aFs,aDir,_L(*.mp3))
{
TParse parse;
parse.Set(aWild, &aDir, NULL);
TPtrC spec(parse.FullName());
TFindFile FindFile(aFs);
CDir* dir;
if(!FindFile.FindWildByPath(parse.FullName(), NULL, dir));
{
// Files Path
}
}
for better Understanding just go through the Documentation for CDirScan and TFindFile
Regards
Praveen
Forum posts: 1134
Oh nice, didn't know about the CDirScan, looks useful