将数据从子文件夹移动到文件夹? [英] Move data from sub folder to folder?
本文介绍了将数据从子文件夹移动到文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含2000个子文件夹的主文件夹,其中包含数据。我需要将数据从子文件夹移动到主文件夹。有什么办法吗?请尽快帮助....
我的尝试:
cut-paste。
但耗时耗时
i have one main folder containing 2000 sub folders with data in it. i need to move the data from sub folder to main folder . is there any solution?? please help....as soon as possible
What I have tried:
cut-paste.
but it is time consuming
推荐答案
这是非常简单的C#代码:
It's pretty trivial C# code:
string root = @"D:\MainFolder";
string[] files = Directory.GetFiles(root, "*.*", SearchOption.AllDirectories);
foreach (string src in files)
{
string filename = Path.GetFileName(src);
string dest = Path.Combine(root, filename);
File.Move(src, dest);
}
这篇关于将数据从子文件夹移动到文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文