目前为止最简洁的C#文件夹Copy代码,不接受反驳
2024-09-01 22:57:57
private static void CopyEntireDir(string sourcePath, string destPath)
{
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
{
Directory.CreateDirectory(dirPath.Replace(sourcePath, destPath));
}
foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
{
File.Copy(newPath, newPath.Replace(sourcePath, destPath), true);
}
}
最新文章
- sql中 in , not in , exists , not exists效率分析
- 新手学Android
- Chapter 6面向对象
- QTreeWidget实现动态加载本地文件系统
- YII 小部件实现的注册表
- 最近 弄了一个 discuz 7.2,管理员发帖 会出现 很多错误,解决 办法 在别的帖子中找到了
- android假设重写onDraw实现一个相似TextView能够显示表情和链接的控件(一)
- nginx.conf 文中描述的配置文件
- Node.js:url
- 在wamp下使用netbeans开启Xdbug
- mysql 合并left join 数据条目
- python logging method 02
- Nuget 多平台多目标快速自动打包
- css实现弹出框
- Centos 7 squid 用户认证
- GIT和SVN版本控制
- Linux驱动之平台设备驱动模型简析(驱动分离分层概念的建立)
- Spring(十四):使用FactoryBean配置Bean
- 用Visual C#创建Windows服务程序
- Python3编程技巧