修改文件夹中的文件名

 

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Text.RegularExpressions;
 6 using System.IO;
 7 
 8 namespace ConsoleApplication1
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {
14 
15             DirectoryInfo dir = new DirectoryInfo(args[0]);
16             bool test = dir.Exists;
17             if (dir.Exists)
18             {
19                 foreach (FileInfo file in dir.GetFiles())
20                 {
21                     File.Move(args[0] + "\\" + file.Name, args[0] + "\\" + "accccc.txt");
22                     break;
23                 }
24             }
25             else
26             {
27                 Console.WriteLine("The directory {0} does not exist", args[0]);
28             }
29 
30         }            
31     }
32 }

 

posted on 2013-08-06 22:35  kakamilan  阅读(238)  评论(0编辑  收藏  举报

导航