• 0

[VB.NET] Simple Program to Copy a file to a remote location


Question

Good Evening!

So, just at home, thinking about work and we have a common problem that requires a certain file to be copied over to a remote computer. So I'm making a really basic program to simplify the task for us.

The idea of it is, we keep the file on the root of C: and it copies it to a remote computer to a specific directory. After doing a little research, here is the simple code I ended up with.

Dim strCompName As String = ""

        strCompName = TextBox1.Text

        My.Computer.FileSystem.CopyFile("C:\file.dll", "\\" & strCompName & "\C$\Program Files\otherlocation")



    End Sub
End Class


Simple right? Well I must be using the wrong call. To test it, because I don't have a domain computer at home, it fails out with an I/O error stating the following:

could not complete operation since a directory already exists in this path

On the domain at work, we have full rights to the machine that is if everything is going right, so impersonation or authentication isn't an issue as far as that goes, but I've never done anything like this in vb so don't know if it is required. Any ideas?

6 answers to this question

Recommended Posts

  • 0
  On 31/05/2010 at 16:26, MrBalladeer said:

Good Idea!

Is there a switch that even if it exists, to overwrite the file? I'm getting an IO Exception: "File already exists"

If I could get it to just overwrite it, I think I would be in business!

My.Computer.FileSystem.CopyFile("C:\file.dll", "\\" & strCompName & "\C$\Program Files\otherlocation\file.dll", True)

^ voila... that simple for overwrite. (Assuming you have write privs)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • You invoke the game bar and then can pin it with transparent background.
    • 100% agree with this " As for real framerate vs framegen framerate, I don't think they exactly want you to know, given that their marketing has been strongly focused on hiding the real framerate and pretending the generated one is all that matters..."
    • I also use the classic Start menu in Open Shell in Windows 10/11
    • However, you would have to invoke it with the Windows key + G; in other words, it's useless. It is Microsoft's logic of placing things, and that is a company who have no idea how to design anything.
    • Samsung 2TB 9100 PRO, 990 PRO NVMe SSDs have never been cheaper by Sayan Sen It looks like the NVMe SSD market is once again coming to life if you are out there hunting for deals. Samsung, for example, is offering its 9100 PRO and 990 PRO drives at great prices that you should absolutely look at if you want to save some major bucks. The discounts apply on 2TB models (purchase links down below). First up, we have the 9100 PRO. It is based on PCIe Gen5 and thus promises double the speed of the 990 PRO. Samsung claims to deliver sequential read and write speeds of up to 14,700 MB/s and 13,400 MB/s, respectively, on the 2TB model. In terms of random throughput, the claimed numbers for the 2TB SKU is 1850K IOPS for the reads and 2600K IOPS for writes. The on-board DRAM cache helps in this regard with 2GB of LPDDR4X on the 2TB. The SSD is built on Samsung's in-house 8th Gen TLC V-NAND flash memory and has endurance ratings of 1200 TBW (terabytes written). Gen5 SSDs are known to run quite hot and thus the included SSDs are a must. You may even upgrade to something even better if you are having trouble managing the heat. Speaking of heat, Samsung says that the drives have an operating temperature of 0 to 70 Celsius, and upon exceeding this temperature, the drive's controller will begin throttling quite heavily. Get it at the link below: SAMSUNG SSD 9100 PRO without Heatsink 2TB, PCIe 5.0x4 M.2 2280 (MZ-VAP2T0CW): $239.99 (Amazon US) || $239.99 (Shipped and Sold by Newegg US) 990 PRO is, on the other hand, the fastest Gen4 drive from Samsung. There are some obvious differences like lower speeds on this compared to the 9100 PRO. Sequential reads and writes are rated at 7450 MB/s and 6900 MB/s respectively. The random throughputs for reads and writes are 1400K IOPS and 1550K IOPS respectively. The 990 PRO is based on Samsung's 7th Gen V-NAND flash and it too is TLC. The endurance rating for this is the same as that of the 9100 PRO. Get it at the link below: Samsung 990 PRO SSD NVMe M.2 PCIe Gen4, M.2 2280, MZ-V9P2T0B/AM: $149.99 (Shipped and Sold Amazon US) || $149.99 (Shipped and Sold by Newegg US) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • First Post
      Thornskade earned a badge
      First Post
    • Week One Done
      Higante88 earned a badge
      Week One Done
    • Conversation Starter
      CarloDuplessis earned a badge
      Conversation Starter
    • First Post
      hhgygy earned a badge
      First Post
    • Collaborator
      WiltshireHam went up a rank
      Collaborator
  • Popular Contributors

    1. 1
      +primortal
      719
    2. 2
      ATLien_0
      278
    3. 3
      Michael Scrip
      204
    4. 4
      +FloatingFatMan
      190
    5. 5
      Steven P.
      129
  • Tell a friend

    Love Neowin? Tell a friend!