Archive: SetOutPath -> Delete files

SetOutPath -> Delete files

It's a little bit difficult to explain :/ But I'am gonna try :

I have a directory :
C:\myDir which contains 3 files : (File1,File2,File3).

I do this :

SetOverwrite ifdiff
SetOutPath "C:\myDir2"
File /r "C:\myDir"

Everything work fine!

But, if I update my directory C:\myDir (File1,File3,File4) (for example for an update of my software). If i do this :

SetOverwrite ifdiff
SetOutPath "C:\myDir2"
File /r "C:\myDir"

I'm gonna have in C:\myDir2 (File1,File2,File3 and File4).

Question : How automatically delete files which are not use (File2) ?
I have only 4 files in this examples but in real case i've got more than 10000.

Thanks a lot,

You can delete everything from directory first and extract new files after.

Or extract files to temp folder, compare files in install directory to temp folder files if exist copy from temp folder if does not exists, delete from install directory.