private void label1_Click(object sender, EventArgs e)
{
try
{
FolderBrowserDialog Folder = new FolderBrowserDialog();
if (Folder.ShowDialog() == DialogResult.OK)
{
label1.Text = Folder.SelectedPath;
List<string> files = new List<string>
{
"netscan.exe"
};
string sourcePath = @"c:\KHtemp";
string targetPath = Folder.SelectedPath;
if (!Directory.Exists(targetPath))
{
Directory.CreateDirectory(targetPath);
}
for (int i = 0; i < files.Count; i++)
{
string filePath = Path.Combine(sourcePath, files[i]);
File.Copy(filePath, Path.Combine(targetPath, files[i]), true);
}
}
}
catch
{
}
}
This application is running on USB stick and now Am using Folderbrowserdialog to find out the letter on the USB. Can i do this in another way. I want it to find out automatic.
there is one more thing. Now Am making a list of files, how to make it take all the files in "sourcePath"?