文件创建与文件格式的修改

string[] file = Directory.GetFiles("E://VSProject//Url_Filter//Url_Filter//bin//Debug");
//先创建几个文件
string type = "mp3|mp4|doc|rmvb|txt|xls|exe|avi";
string path = System.AppDomain.CurrentDomain.BaseDirectory;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
Random rand = new Random();
string[] ts = type.Split('|');
for (int i = 0; i < 1; i++)
{
File.Create(Path.Combine(path, Path.ChangeExtension(i.ToString(), ts[rand.Next(ts.Length)])));
}
string[] files = Directory.GetFiles(path, "*.dll");
foreach(string s in files)
{
Console.WriteLine(s);
}

posted @ 2016-08-13 11:22  TheSongOfSoul  阅读(179)  评论(0编辑  收藏  举报