using System;
using System.IO;
namespace ConsoleApplication7
{
/// <summary>
/// Class1
摘要说明
/// </summary>
class Class1
{
/// <summary>
/// 应用程序
主入口点
/// </summary>
[STAThread]
static void Main(string[] args)
{
string dirp=@"d:\\d";
DirectoryInfo mydir = new DirectoryInfo(dirp);
foreach (FileSystemInfo fsi in mydir.GetFileSystemInfos())
{
if (fsi is FileInfo)
{
FileInfo fi = (FileInfo)fsi;
string x=System.IO.Path.GetDirectoryName(fi.FullName);
Console.WriteLine(x);
string s=System.IO.Path.GetExtension(fi.FullName);
string y=System.IO.Path.GetFileNameWithoutExtension(fi.FullName);
Console.WriteLine(y);
if(s==".jpg")
{
System.IO.File.Copy(fi.FullName,x+@"\oo"+fi.Name); //
原文件名前加上OO
System.IO.File.Delete(fi.FullName);
}
}
}
Console.WriteLine("成功");
Console.ReadLine();
}
}
}