惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Exploit Database - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Security Affairs
N
News and Events Feed by Topic
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
Attack and Defense Labs
Attack and Defense Labs
Google Online Security Blog
Google Online Security Blog
MongoDB | Blog
MongoDB | Blog
N
News and Events Feed by Topic
Recent Commits to openclaw:main
Recent Commits to openclaw:main
WordPress大学
WordPress大学
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
L
LINUX DO - 最新话题
博客园 - 三生石上(FineUI控件)
Scott Helme
Scott Helme
U
Unit 42
Cyberwarzone
Cyberwarzone
博客园_首页
F
Full Disclosure
月光博客
月光博客
罗磊的独立博客
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
小众软件
小众软件
Recent Announcements
Recent Announcements
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
The Hacker News
The Hacker News
Help Net Security
Help Net Security
GbyAI
GbyAI
Y
Y Combinator Blog
博客园 - 聂微东
Security Archives - TechRepublic
Security Archives - TechRepublic
Jina AI
Jina AI
S
Schneier on Security
Martin Fowler
Martin Fowler
The Last Watchdog
The Last Watchdog
D
DataBreaches.Net
T
Tor Project blog
V
Visual Studio Blog
博客园 - 【当耐特】
T
Troy Hunt's Blog
G
Google Developers Blog
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News

博客园 - zhengfeng

GridView 72般绝技 链接打开固定大小的新窗口 iframe传值和自适应高度 页面传参 小技巧 js表单验证控制代码大全 - zhengfeng - 博客园 自己写的递归方法复制文件夹里面的内容(从源文件(里面可以有多个层次的子文件夹)到一个文件夹) 递归写的复制文件夹及其下的内容(原样复制) JS取得URL中的参数值 使用 Hashtable 集合(一) MessageBox.Show用法 System.IO.File类和System.IO.FileInfo类 Math.floor和Math.ceil函数 Document对象 javascript小技巧 JavaScript的学习 正则表达式的学习: 工作小结: DataList分页
自己写的将文件从多个文件合并到一个文件夹的小方法
zhengfeng · 2007-07-20 · via 博客园 - zhengfeng

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Program manger = new Program();
            manger.CopyPicToFileDirectory("E:\\资讯抓取\\Images", "E:\\资讯抓取\\图片");
        }
        private void CopyPicToFileDirectory(string sourcePath, string desPath)
        {
         
                string[] dirs1 = null;
                string[] dirs2 = null;
                bool desFileDirectory = System.IO.Directory.Exists(desPath);
                if (desFileDirectory == false)
                {
                    Directory.CreateDirectory(desPath);
                }
                dirs1 = Directory.GetDirectories(sourcePath);
                for (int i = 0; i < dirs1.Length; i++)
                {
                    try
                    {
                        dirs2 = Directory.GetFiles(dirs1[i]);
                        for (int j = 0; j < dirs2.Length; j++)
                        {
                            FileInfo file = new FileInfo(dirs2[j]);
                            string filename = file.Name;
                            file.CopyTo(desPath + "\\" + filename, true);
                        }
                    }
                  catch (Exception ex)
                  {
                      Console.Write(ex.Message);
                      continue;
                  }
                }
          }
      

    }
}