1
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"?

domdomcodecode
  • 2,355
  • 4
  • 19
  • 27
Tobbe
  • 23
  • 3
  • Welcome to Stack Overflow. Please read the welcome tour in the help center and read [ask]. Your question is to broad (couple of questions in one), lacks research effort (what have you tried?) and all of your questions have been answered before. Please try searching, and if you did, show what you found and why t that didn't work. – CodeCaster Dec 15 '15 at 23:34

0 Answers0