欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

C#获取文件创建时间的方法

程序员文章站 2022-10-15 15:27:54
本文实例讲述了c#获取文件创建时间的方法。分享给大家供大家参考。具体如下: c#获取文件创建时间,主要用到了fileinfo的creattiontime属性 u...

本文实例讲述了c#获取文件创建时间的方法。分享给大家供大家参考。具体如下:

c#获取文件创建时间,主要用到了fileinfo的creattiontime属性

using system;
using system.io;
class class1 {
 static void main(string[] args) {
  string[] cla = environment.getcommandlineargs();
  if (cla.getupperbound(0) == 2) {
   fileinfo fi = new fileinfo(cla[1]);
   fi.moveto(cla[2]);
   console.writeline("file created:" + fi.creationtime.tostring());
   console.writeline("moved to : " + cla[2]);
  } else
   console.writeline("usage: mv <source file> <destination file>");
 }
}

希望本文所述对大家的c#程序设计有所帮助。