My image URL is like this:
photo\myFolder\image.jpg
I want to change it so it looks like this:
photo\myFolder\image-resize.jpg
Is there any short way to do it?
This following code snippet changes the filename and leaves the path and the extenstion unchanged:
string path = @"photo\myFolder\image.jpg"; string newFileName = @"image-resize"; string dir = Path.GetDirectoryName(path); string ext = Path.GetExtension(path); path = Path.Combine(dir, newFileName + ext); // @"photo\myFolder\image-resize.jpg"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With