How to delete files matching a specific pattern (e.g. *.tmp) in a given folder

Sounds as a simple question but I could not locate an existing solution
yossikallyAsked:
Who is Participating?
 
alb66Commented:
An MFC solution:


      CString strFolder = "\\Your folder"

      CFileFind oFinder;

      BOOL bFound = oFinder.FindFile( strFolder + "\\*.*" );
      while ( bFound )
      {
            bFound = oFinder.FindNextFile();

            if ( oFinder.IsDots() || oFinder.IsDirectory() )
                  continue;

            CString strFilePath = oFinder.GetFilePath();

            ... do something with file...
      }
0
 
yossikallyAuthor Commented:
Would it be possible to get a link to a working example
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.