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. .NET (Core and Framework)
  4. Urgent Help Required

Urgent Help Required

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpsysadminhelpquestion
9 Posts 8 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.
  • W Offline
    W Offline
    waqas_2k
    wrote on last edited by
    #1

    how can i copy files and folders from a specific location on my computer to a remote pc on my network using c# code and a window form based application

    D R 3 Replies Last reply
    0
    • W waqas_2k

      how can i copy files and folders from a specific location on my computer to a remote pc on my network using c# code and a window form based application

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Have you looked at the File class[^] in the System.IO namespace?? Are you familiar with the way Windows networking works in Workgroup and Domain modes? If not, you're going to find this a rather difficult project to work on.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      • W waqas_2k

        how can i copy files and folders from a specific location on my computer to a remote pc on my network using c# code and a window form based application

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        And putting "Urgent" anywhere in your post tends to get you ignored. If it were that "urgent", you'd either be Googling this question to until your fingers bled, or running to the bathroom, whichever the case may be.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        O P S 3 Replies Last reply
        0
        • W waqas_2k

          how can i copy files and folders from a specific location on my computer to a remote pc on my network using c# code and a window form based application

          R Offline
          R Offline
          Richard Jones
          wrote on last edited by
          #4

          Check out File.Copy.

          using System;
          using System.IO;

          class Test
          {
          public static void Main()
          {
          string path = @"c:\temp\MyTest.txt";
          if (!File.Exists(path))
          {
          // Create a file to write to.
          using (StreamWriter sw = File.CreateText(path))
          {
          sw.WriteLine("Hello");
          sw.WriteLine("And");
          sw.WriteLine("Welcome");
          }
          }

              // Open the file to read from.
              using (StreamReader sr = File.OpenText(path)) 
              {
                  string s = "";
                  while ((s = sr.ReadLine()) != null) 
                  {
                      Console.WriteLine(s);
                  }
              }
          
              try 
              {
                  string path2 = path + "temp";
                  // Ensure that the target does not exist.
                  File.Delete(path2);
          
                  // Copy the file.
                  File.Copy(path, path2);
                  Console.WriteLine("{0} was copied to {1}.", path, path2);
          
                  // Delete the newly created file.
                  File.Delete(path2);
                  Console.WriteLine("{0} was successfully deleted.", path2);
              } 
              catch (Exception e) 
              {
                  Console.WriteLine("The process failed: {0}", e.ToString());
              }
          }
          

          }

          Paul Watson wrote: Like, if you say sort of, like, you know, one more, you know, time, I'm going to, like, you know, sort of sort you out, you know.

          1 Reply Last reply
          0
          • D Dave Kreskowiak

            And putting "Urgent" anywhere in your post tends to get you ignored. If it were that "urgent", you'd either be Googling this question to until your fingers bled, or running to the bathroom, whichever the case may be.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            O Offline
            O Offline
            originSH
            wrote on last edited by
            #5

            And it's a cross post :/

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              And putting "Urgent" anywhere in your post tends to get you ignored. If it were that "urgent", you'd either be Googling this question to until your fingers bled, or running to the bathroom, whichever the case may be.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              P Offline
              P Offline
              Paul Conrad
              wrote on last edited by
              #6

              Dave Kreskowiak wrote:

              f it were that "urgent", you'd either be Googling this question to until your fingers bled, or running to the bathroom, whichever the case may be.

              Very true :)

              "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

              1 Reply Last reply
              0
              • D Dave Kreskowiak

                And putting "Urgent" anywhere in your post tends to get you ignored. If it were that "urgent", you'd either be Googling this question to until your fingers bled, or running to the bathroom, whichever the case may be.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007

                S Offline
                S Offline
                Sathesh Sakthivel
                wrote on last edited by
                #7

                Dave Kreskowiak wrote:

                If it were that "urgent", you'd either be Googling this question to until your fingers bled, or running to the bathroom, whichever the case may be.

                Well said Dave.

                Regards, Satips.:rose: Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead; Walk beside me, and just be my friend. - Albert Camus

                A 1 Reply Last reply
                0
                • S Sathesh Sakthivel

                  Dave Kreskowiak wrote:

                  If it were that "urgent", you'd either be Googling this question to until your fingers bled, or running to the bathroom, whichever the case may be.

                  Well said Dave.

                  Regards, Satips.:rose: Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead; Walk beside me, and just be my friend. - Albert Camus

                  A Offline
                  A Offline
                  Andy M
                  wrote on last edited by
                  #8

                  Say something useful dammit! Don't post rubbish like that constantly.

                  V 1 Reply Last reply
                  0
                  • A Andy M

                    Say something useful dammit! Don't post rubbish like that constantly.

                    V Offline
                    V Offline
                    Vasudevan Deepak Kumar
                    wrote on last edited by
                    #9

                    :)

                    Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                    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