111
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_16_2</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36623.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16_2", "16_2.csproj", "{894B436F-A57A-4945-9B44-C9F2999B099D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{894B436F-A57A-4945-9B44-C9F2999B099D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{894B436F-A57A-4945-9B44-C9F2999B099D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{894B436F-A57A-4945-9B44-C9F2999B099D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{894B436F-A57A-4945-9B44-C9F2999B099D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D6F600F8-25B4-4E93-AF52-22E987FC78C2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace _16_2
|
||||
{
|
||||
class CopyDir
|
||||
{
|
||||
static public void CopyDirectory(string srcDir, string dstDir)
|
||||
{
|
||||
DirectoryInfo src = new DirectoryInfo(srcDir);
|
||||
DirectoryInfo dst = new DirectoryInfo(dstDir);
|
||||
if (!src.Exists) return;
|
||||
if (!dst.Exists) dst.Create();
|
||||
FileInfo[] sfs = src.GetFiles();
|
||||
for (int i = 0; i < sfs.Length; i++) File.Copy(sfs[i].FullName, sfs[i].FullName + "\\" + sfs[i].Name, true);
|
||||
DirectoryInfo[] srcDirs = src.GetDirectories();
|
||||
for (int j = 0; j < srcDirs.Length; j++)
|
||||
CopyDirectory(srcDirs[j].FullName, dst.FullName + "\\" + srcDirs[j].Name);
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
string src = args[0];
|
||||
string dst = args[1];
|
||||
CopyDirectory(src, dst);
|
||||
Console.WriteLine("\n 源目录{0}的内容已复制到目标目录{1}中", src, dst);
|
||||
}
|
||||
catch (Exception e) { Console.WriteLine("\n 操作失败 {0}", e.ToString()); }
|
||||
finally { }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user