2 u013054295 u013054295 于 2013.12.05 15:56 提问

c#模拟命令提示板上的copy指令

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CmdDemo
{
public class Cmd
{
public static void dir()
{
// var path = System.Windows.Forms.Application.StartupPath;
dir(System.Environment.CurrentDirectory);

    }
    public static void dir(string path)
    {          

        DirectoryInfo di = new DirectoryInfo(path);

        foreach (var d in di.GetDirectories())
        {
            Console.WriteLine("{0}\t<DIF>\t{1}",d.CreationTime,d.Name);
        }

        foreach (var f in di.GetFiles())
        {
            Console.WriteLine("{0}\t\t{1}", f.CreationTime, f.Name);
        }
        Console.WriteLine("\t\t{0} 个文件",di.GetFiles().Count());
        Console.WriteLine("\t\t{0} 个目录", di.GetDirectories().Count());
    }

    public static void cd(string path)
    {
        System.Environment.CurrentDirectory = path;
    }
    public static void del(string filePath)
    {
        if (!System.IO.File.Exists(filePath))
        {
            Console.WriteLine("找不到{0}", filePath);
            Console.WriteLine();
            return;
        }
        System.IO.File.Delete(filePath);
    }
    public static void copy(string sourceFileName,string destFileName) 
    {
         ?????
    }
}

}
我刚刚学习c#,想模拟copy指令。刚刚学习还有很多不懂,上面是代码,求问号地方的代码,我也百度过,看不懂,求指导,谢谢

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!