C# Implementation of the File Copy Command

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.CopyTo(cla[2],true);
        Console.WriteLine("Copied " + fi.Length + " bytes.");
      }
      else{
        Console.WriteLine ("Usage: cp <input file> <output file>");
      }
    }
  }

           
          


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