Aug 10, 2011

how to copy only text files from one folder to another folder


private void button7_Click(object sender, EventArgs e)
        {
            string[] files = Directory.GetFiles("C:\\Windows\\", "*.txt");

            foreach (string file in files)
            {
             

                File.Copy(file, @"C:\Users\vmunnamgi3\AppData\Local\Temp" + file.Replace("C:\\Windows", ""), true);
                }
            }

        }

No comments:

Post a Comment