Here is a solution for copy files:
string fileName = "test.mp3";
string sourcePath = @"C:\dir\";
string targetPath = @"C:\dir\subdir\";
string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
string destFile = System.IO.Path.Combine(targetPath, fileName);
if (!System.IO.Directory.Exists(targetPath))
{
System.IO.Directory.CreateDirectory(targetPath);
}
System.IO.File.Copy(sourceFile, destFile, true);
Copy more files at once:
if (System.IO.Directory.Exists(sourcePath))
{
string[] files = {"C:\\dir\\1.mp3", "C:\\dir\\2.mp3", "C:\\dir\\3.mp3"};
foreach (string s in files)
{
string fileName = "1.mp3";
string targetPath = @"C:\dir\subdir\";
string destFile = System.IO.Path.Combine(targetPath, fileName);
System.IO.File.Copy(s, destFile, true);
}
}
else
{
}