Get file Creation time from FileInfo

image_pdfimage_print
   
 

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>");
    }
}
           
         
     


This entry was posted in File Stream. Bookmark the permalink.