public bool CopyOldLabFilesToNewLab(string sourcePath, string savePath)
{
if (!Directory.Exists(savePath))
{
Directory.CreateDirectory(savePath);
}

#region
try
{
string[] labDirs = Directory.GetDirectories(sourcePath);//目录
string[] labFiles = Directory.GetFiles(sourcePath);//文件
if (labFiles.Length > 0)
{
for (int i = 0; i < labFiles.Length; i++)
{
if (Path.GetExtension(labFiles[i]) != ".lab")
{
File.Copy(sourcePath + "\\" + Path.GetFileName(labFiles[i]), savePath + "\\" + Path.GetFileName(labFiles[i]), true);
}
}
}
if (labDirs.Length > 0)
{
for (int j = 0; j < labDirs.Length; j++)
{
Directory.GetDirectories(sourcePath + "\\" + Path.GetFileName(labDirs[j]));

//递归调用
CopyOldLabFilesToNewLab(sourcePath + "\\" + Path.GetFileName(labDirs[j]), savePath + "\\" + Path.GetFileName(labDirs[j]));
}
}
}
catch (Exception)
{
return false;
}
#endregion
return true;
}

最新文章

  1. bzoj1835[ZJOI2010]base基站选址
  2. flash 自定义右键功能
  3. 数往知来C#面向对象准备〈二〉
  4. 【转】Adobe CC 的下载地址
  5. ubuntu 100M 到 10M
  6. JAVA学习:方法
  7. C程序设计语言练习题1-5
  8. C#JSON序列化与反序列化
  9. Centos6.7安装chrome
  10. 动态SQL之、条件判断(转)
  11. Visual Studio 2015 插件开发入门
  12. Go 初体验 - 令人惊叹的语法 - defer.3 - defer 函数参数计算时机
  13. Android 信号处理面面观 之 信号定义、行为和来源
  14. 10.18号java课后作业代码
  15. 关于Excel分析图插入到论文的问题
  16. 微信支付HTTPS服务器证书验证指引
  17. Tomcat性能优化(三) Executor配置
  18. 实习培训——Java基础(4)
  19. 模拟form表单请求上传文件
  20. 错误:严重: Servlet.service() for servlet [appServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is

热门文章

  1. jsp获取sina天气
  2. (最新)各大公司Java后端开发面试题总结
  3. PPAPI与Browser间使用AsyncIPC通信
  4. Http常用状态码及含义
  5. VK Cup 2016 - Round 1 (Div. 2 Edition) C. Bear and Forgotten Tree 3
  6. lstat函数的使用【学习笔记】
  7. contents属性
  8. WAS:启动服务后,server一会挂起。
  9. hdu 1075 What Are You Talking About(map)
  10. NOSQL安全攻击