• 文佳夹之移动


    移动文件夹可通过directory类下的Move方法来实现,

    其格式为:Directory.Move(source,descretion);

    当目标文件夹含有同名文件时,会抛出错误。

    只能在同一个盘符下移动不可以跨盘符。

    通过移动文件夹,不仅可以改变文佳夹目录,还可以实现对文件夹的重命名。

    static void Main(string[] args)
            {
                string path = @"D:新建文件夹";
                string depath = @"D:WebSite新建文件";
                if (Directory.Exists(path))
                {
                    Directory.Move(path,depath);
                    Console.WriteLine("文佳夹移动成功");
                }
                else
                {
                    Console.WriteLine("文佳夹不存在,无法移动");
                }
                Console.Read();
            }

    文佳夹的重命名

     static void Main(string[] args)
            {
                string path = @"D:新建文件夹";
                string depath = @"D:5151";
                if (Directory.Exists(path))
                {
                    Directory.Move(path,depath);
                    Console.WriteLine("文佳夹移动成功");
                }
                else
                {
                    Console.WriteLine("文佳夹不存在,无法移动");
                }
                Console.Read();
            }
  • 相关阅读:
    poj 2391 Ombrophobic Bovines
    混合欧拉回路poj 1637 Sightseeing tour
    POJ1149-PIGS
    C
    B
    A
    C
    B
    A
    O
  • 原文地址:https://www.cnblogs.com/xiaowie/p/8668487.html
Copyright © 2020-2023  润新知