I'm trying to create a backup of a folder, what I'm having problem with is if the backup folder already has files that exist in the original folder how do I get it to move onto the next file without over writing?
What I have tried:
I'm currently having to over write the existing files using the code below.
My.Computer.FileSystem.CopyDirectory(TextBox5.Text + "\item\ModelItem\Mesh\", TextBox5.Text + "\item\ModelItem\BACKUP\", True)
The full code if you need to know or some help on how I can make it a little nicer. I know it's ugly but I'm new to this and just need simplicity which usually equates to ugly code for me :)
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If My.Computer.FileSystem.DirectoryExists(TextBox5.Text + "\item\ModelItem\Mesh\") AndAlso My.Computer.FileSystem.FileExists(TextBox5.Text + "\RF.exe") Then
Button3.BackColor = Color.Lime
TextBox5.Enabled = False
Button4.Enabled = False
TextBox6.Enabled = False
MessageBox.Show("Everything Is in the right place, now load RF And once on the server selection screen make your loot choice.")
If Not My.Computer.FileSystem.DirectoryExists(TextBox5.Text + "\item\ModelItem\BACKUP\") Then
My.Computer.FileSystem.CopyDirectory(TextBox5.Text + "\item\ModelItem\Mesh\", TextBox5.Text + "\item\ModelItem\BACKUP\")
MessageBox.Show("There is no backup of your files, creating one now.")
Else
My.Computer.FileSystem.CopyDirectory(TextBox5.Text + "\item\ModelItem\Mesh\", TextBox5.Text + "\item\ModelItem\BACKUP\", True)
End If
Else Button3.BackColor = Color.Red
MessageBox.Show("Something appears to be wrong, direct this app to your '\RF Online' directory then click the check button.")
End If
End Sub