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

推荐订阅源

B
Blog RSS Feed
博客园_首页
N
News | PayPal Newsroom
有赞技术团队
有赞技术团队
The Hacker News
The Hacker News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
S
SegmentFault 最新的问题
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
P
Privacy & Cybersecurity Law Blog
AI
AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Schneier on Security
Schneier on Security
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
量子位
Forbes - Security
Forbes - Security
爱范儿
爱范儿
云风的 BLOG
云风的 BLOG
SecWiki News
SecWiki News
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tor Project blog
Recorded Future
Recorded Future
A
About on SuperTechFans
J
Java Code Geeks
The Register - Security
The Register - Security
PCI Perspectives
PCI Perspectives
H
Hacker News: Front Page
V2EX - 技术
V2EX - 技术
S
Secure Thoughts
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Scott Helme
Scott Helme
T
The Exploit Database - CXSecurity.com
Y
Y Combinator Blog
AWS News Blog
AWS News Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
IT之家
IT之家
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
F
Full Disclosure
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The GitHub Blog
The GitHub Blog

博客园 - 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;
                  }
                }
          }
      

    }
}