Joel F Real men use unique_ptr | Simple lorque tu trouve un fichier teste si c un fichier ou un folder (File.IsFolder je crois), si c un folder, tu relance ta fonction de listage en partant de ce folder. Une fonction ecursive koi ...
Code :
- void recursiveFileFind( CString root )
- {
- CFileFind filefind;
- CString path;
- path.format("%s\\*.*", root );
- if(filefind.FindFile(path)
- {
- if(filefind.FindNextFile())
- {
- path=filefind.GetRoot();
- m_CtlTree.InsertItem(path,0,0);
- while(filefind.FindNextFile())
- {
- //on cherche le prochain fichier si il existe
- //on recupere son nom
-
- path=filefind.GetFilePath();
- //on l'affiche dans le tree view
- m_CtlTree.InsertItem(path,0,0);
- // si c un directory, on repart.
- if( filefind.isDirectory() )
- {
- CString newroot;
- newroot = root + path;
- recursiveFileFind( newroot );
- }
- }
- }
- }
|
|