Created
July 25, 2023 17:05
-
-
Save Xwilarg/e81746c76b967e2564ab1422c872e2aa to your computer and use it in GitHub Desktop.
Convert a bunch of file to a specified format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
Console.WriteLine("What input format do you want?"); | |
string format = Console.ReadLine(); | |
Console.WriteLine("Enter the location of the files"); | |
string path = Console.ReadLine(); | |
void ConvertFolder(string path) | |
{ | |
foreach (var f in Directory.GetFiles(path)) | |
{ | |
var fi = new FileInfo(f); | |
var name = Path.GetFileNameWithoutExtension(fi.Name); | |
Process.Start("ffmpeg", $"-i {f} {path}{Path.DirectorySeparatorChar}{name}.{format}"); | |
} | |
foreach (var d in Directory.GetDirectories(path)) | |
{ | |
ConvertFolder(d); | |
} | |
} | |
ConvertFolder(path); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.