怎么使用C#进行文件遍历并且在各文件下实现文件复制功能 求源代码 老师布置的任务

如何使用C#进行文件遍历并且在各文件下实现文件复制功能 求源代码 老师布置的任务
如何使用C#进行文件遍历并且在各文件下实现文件复制功能 求源代码 老师布置的任务
------解决方案--------------------
骚年好好学习,别老求代码,给你微软的msdn,自己去查查,一个是路径一个是文件
http://msdn.microsoft.com/zh-cn/library/System.IO.Directory(v=vs.110).aspx
http://msdn.microsoft.com/zh-cn/library/System.IO.File_methods(v=vs.80).aspx
------解决方案--------------------
http://www.cnblogs.com/eecc/articles/1261126.html
------解决方案--------------------
自己做吧。。参考msdn
------解决方案--------------------
引用:
自己做吧。。参考msdn
怎么使用C#进行文件遍历并且在各文件下实现文件复制功能 求源代码 老师布置的任务
 //拷贝文件
                                #region
                                try
                                {
                                    //文件在erp系统中路径
                                    string documnetpath = txtPath.Text.Trim() + imgpath;                            
                                    
                                    
                                    DirectoryInfo info = new DirectoryInfo(documnetpath);

                                    if (info.Exists)
                                    {
                                        FileInfo[] files = info.GetFiles();
                                        foreach (FileInfo file in files)
                                        {
                                            if (file.Name == (list["PhotoPath"].ToString().Substring(list["PhotoPath"].ToString().IndexOf('/') + 1)))
                                            {
                                                try
                                                {
                                                    File.Copy(documnetpath + file.Name, path + file.Name, true); //复制文件
                                                }