Win API - Delete all files except some

183 Views Asked by At

Consider I want to write a program that delete all files in a given directory, except for few files which the user can define to preserve (by using a config file for example). Is there a native way to do it? The direct approach is to loop over all the files and to decide for each of them if to call DeleteFile or not. But is it the right approach?

Thanks.

0

There are 0 best solutions below