locked
Copy file with original filename? RRS feed

  • Question

  • I want to do the above mention task.

    i tried to do with

    File.Copy("D:\juman.exe", "C:\juman.exe")
    
    but as you see i had to type the file name.

    every time the file would not be the same thats why i cant write the name in to the program. i tried and tried all i get is a error message.

    Sunday, January 30, 2011 3:37 PM

Answers

  • Hi

     

    Maybe this will point you in the right direction

     Dim myFile As String = "D:\juman.exe"
     Dim newPath As String = "C:\"
     Dim filename As String = My.Computer.FileSystem.GetName(myFile)
     Dim newFile As String = newPath & filename
    


    Regards from Livingston, Scotland (Please ignore any stupid formatting produced by this forum)
    • Marked as answer by JmanRasheed Sunday, January 30, 2011 4:39 PM
    Sunday, January 30, 2011 4:33 PM

All replies

  • Hi

     

    Maybe this will point you in the right direction

     Dim myFile As String = "D:\juman.exe"
     Dim newPath As String = "C:\"
     Dim filename As String = My.Computer.FileSystem.GetName(myFile)
     Dim newFile As String = newPath & filename
    


    Regards from Livingston, Scotland (Please ignore any stupid formatting produced by this forum)
    • Marked as answer by JmanRasheed Sunday, January 30, 2011 4:39 PM
    Sunday, January 30, 2011 4:33 PM
  • thanxx it works.
    Sunday, January 30, 2011 4:40 PM