Imports System.IO
Public Class Form1
Private file_name As String = "jpeg.rtf"
Private tempString As String = Date.Now
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'/////////////////////////////
tempString = tempString.Replace("/", "-")
'// unless you replace these character, the file name returns invalid and causes errors.
tempString = tempString.Replace(":", ".")
'////////////////////////////
Dim path1 As String = Trim("D:\frs\files\" & file_name)
Dim path2 As String = Trim("D:\frs\versions\" & tempString & " " & file_name) '// modified.
File.Copy(path1, path2)
MsgBox("File copied to:" & vbNewLine & path2)
End
End Sub
End Class As mentioned, you are trying to create a file with invalid characters for the file name.
Also,you are trying to copy the file to a folder that does not exist so I modified the code in path2.
One more thing, your declared variable "Now" might conflict with the vb.net code for Now.
Try using something that does not cause/or could cause conflicts.
Hope this helps.