Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to send a file in batch mode ?

How to send a file in batch mode ?

Scheduled Pinned Locked Moved C#
sysadmintutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sundar156
    wrote on last edited by
    #1

    How do we send a file in batch mode to a computer in the same network?

    Luck is Opportunity with hardwork

    M 1 Reply Last reply
    0
    • S sundar156

      How do we send a file in batch mode to a computer in the same network?

      Luck is Opportunity with hardwork

      M Offline
      M Offline
      Malcolm Smart
      wrote on last edited by
      #2

      namespace ConsoleApplication4
      {
      class Program
      {
      static void Main(string[] args)
      {
      //source target paths
      string targetComputerPath = "//myServer/myShare/";
      string sourceComputerPath = "c:/test/";

              //build up a list of files
              ArrayList myFiles = new ArrayList();
              
              myFiles.Add("file1.txt");
              myFiles.Add("file2.txt");
              myFiles.Add("file3.txt");
      
              //send each one
              foreach (string fileName in myFiles)
              {
                  string target = targetComputerPath + fileName;
                  string source = sourceComputerPath + fileName;
                  System.IO.File.Copy(source , target);
              }
          }
      }
      

      }

      and then there's error handling to think of...

      Regards Malc *********************************************

      S 1 Reply Last reply
      0
      • M Malcolm Smart

        namespace ConsoleApplication4
        {
        class Program
        {
        static void Main(string[] args)
        {
        //source target paths
        string targetComputerPath = "//myServer/myShare/";
        string sourceComputerPath = "c:/test/";

                //build up a list of files
                ArrayList myFiles = new ArrayList();
                
                myFiles.Add("file1.txt");
                myFiles.Add("file2.txt");
                myFiles.Add("file3.txt");
        
                //send each one
                foreach (string fileName in myFiles)
                {
                    string target = targetComputerPath + fileName;
                    string source = sourceComputerPath + fileName;
                    System.IO.File.Copy(source , target);
                }
            }
        }
        

        }

        and then there's error handling to think of...

        Regards Malc *********************************************

        S Offline
        S Offline
        sundar156
        wrote on last edited by
        #3

        Thank you.. :)

        Luck is Opportunity with hardwork

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups