Scaaning the files

Login to reply to this topic.
Thu, 2008-01-24 10:55
Joined: 2007-12-07
Forum posts: 3

when creating a mp3 player,what should i do if i want to scan the whole mobile to get the files of mp3 present in different locations in the mobile??


Thu, 2008-01-24 11:29
Joined: 2004-11-29
Forum posts: 1134
Re: Scaaning the files

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 Smiling

Thu, 2008-01-24 11:31
Joined: 2007-08-31
Forum posts: 54
Re: Scaaning the files

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

Thu, 2008-01-24 11:30
Joined: 2004-11-29
Forum posts: 1134
Re: Scaaning the files

Oh nice, didn't know about the CDirScan, looks useful Smiling

  • Login to reply to this topic.