I am calling java.lang.Runtime.exec(...) in my Java program to run a command, say:
ffmpeg -i input.mp4 output.mp4.
This is simply passed to my function to run:
private static void RunCommand(String command) throws InterruptedException {
try {
// Execute command
Process proc = Runtime.getRuntime().exec(command);
}
}
Everything is OK. But my question is to handle cases when the file already exists, so asks if it should replace it:
File 'output.avi' already exists. Overwrite ? [y/N]
What is the simplest way to ignore it (always assume y and replace)? Maybe through Java in code or FFMPEG command itself?