JPEG files are not text files. You need to Read and write bytes instead. ie:
DirectoryInfo d = new DirectoryInfo(@"E:\New folder (2)");
FileInfo[] Files = d.GetFiles();
foreach (FileInfo file in Files)
{
string changed = Path.ChangeExtension(file.FullName, "jpg");
File.Copy(file.FullName, changed);
}
Of course file themselves should be JPEG for this to work.
4
solved Changing the extension of multiple files to jpeg using C#