C#复制或删除文件夹(及文件夹下所有子文件夹和文件)、获取文件所在文件夹、二进制读取文件相关
代码很简单,就不做解释了,直接拷贝可用。
更多示例代码,可以访问微软示例代码(Samples from microsoft)All-In-One Code:<A href=
"http://1code.codeplex.com"
>http://1code.codeplex.com</A>
<PRE
class
=brush:csharp;gutter:
false
;><DIV
class
=cnblogs_Highlighter><PRE
class
=brush:csharp;gutter:
false
;>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.IO;
namespace
ZipOneCode.FileProvider
{
public
class
FileHelper
{
/// <summary>
/// 复制文件夹(及文件夹下所有子文件夹和文件)
/// </summary>
/// <param name="sourcePath">待复制的文件夹路径</param>
/// <param name="destinationPath">目标路径</param>
public
static
void
CopyDirectory(String sourcePath, String destinationPath)
{
DirectoryInfo info =
new
DirectoryInfo(sourcePath);
Directory.CreateDirectory(destinationPath);
foreach
(FileSystemInfo fsi
in
info.GetFileSystemInfos())
{
String destName = Path.Combine(destinationPath, fsi.Name);
if
(fsi
is
System.IO.FileInfo) &n补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,
部分文章来自网络,