Hello cebe_noyan,
I did not get you question properly but here is my interpretation of your problem:
You want to copy files specified (source files)in a listbox to a specific directory(target location). I take that the path of the source files if given.
Here's the solution i propose:
using System.IO;
string sourceDir = "C:\\Test";
string target = "D:\\Test\\";
string[] sDirFiles = Directory.GetFiles(sourceDir);
if (sDirFiles.Length > 0)
{
foreach (string file in sDirFiles)
{
string[] splitFile = file.Split('\\');
string copyFile = Path.GetFileName(file);
string source = sourceDir + "\\" + copyFile;
Copy(source,target);
}
}
public void Copy(string source, string target)
{
try
{
if (File.Exists(target))
{
File.Delete(target);
}
File.Copy(source, target);
}
catch (Exception ee)
{
}
}
I sincerely hope it helps. If it isn;t what you are looking for, would you explain your question a bit more?
Thanx,
Umer