I have a folder on my local machine that contains .jpeg files. I want to select all of these images and save them in the other folder. That is all. I am using c# and ASP.NET Webforms. Is there an easy way of doing so?
Thank you.
Something like this should do the trick:
var filesToCopy = Directory.EnumerateFiles(@"c:\path to images", "*.jpeg");
var directoryToCopyTo = "c:\destination folder";
foreach (var file in filesToCopy)
{
File.Copy(file, Path.Combine(directoryToCopyTo, Path.GetFileName(file)));
}
Note: This won't copy images in sub-folders