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
Who is Participating?
An MFC solution:

      CString strFolder = "\\Your folder"

      CFileFind oFinder;

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

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

            CString strFilePath = oFinder.GetFilePath();

            ... do something with file...
yossikallyAuthor Commented:
Would it be possible to get a link to a working example
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.