Reputation: 51
I have the desire to add file extensions and not change the old extension. Suppose file.jpg becomes file.jpg.bmp is that possible ?
string filename;
string[] file = Directory.GetFiles(folder_path);
foreach (string myfile in file)
{
filename = Path.ChangeExtension(myfile, ".bmp");
System.IO.File.Move(myfile, filename);
}
my code only changes extensions, for example file.jpg becomes a file .bmp
I want to be file.jpg.bmp
Please help thanks
Upvotes: 0
Views: 227
Reputation: 363
Try something like that:
string[] file = Directory.GetFiles(folder_path);
foreach (string myfile in file)
{
System.IO.File.Move(myfile, myfile + ".bmp");
}
Upvotes: 4