How to override/replace microsoft essential encoder file?

75 Views Asked by At

Using encoder (Link), To record video which is playing on screen for Selenium automation script.

 ScreenCaptureJob scj = new ScreenCaptureJob();
 scj.OutputScreenCaptureFileName = "XXX.avi";
 scj.Start();

It is required to delete existing file, before to write .avi file on existing name.

Is it possible to replace existing file Or override it ?

2

There are 2 best solutions below

1
Jitendra Banshpal On BEST ANSWER

You can try deletion of file before saving it:

try {
    Files.deleteIfExists(Paths.get("PATH TO FILE\"XXX.avi"));
} catch (IOException e) {
    e.printStackTrace();
}
0
Ishita Shah On

With reference to C# utility, Implemented as:

if (File.Exists(path))
{
File.Delete(path);
}