We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Private Sub btnNormalizar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNormalizar.Click Dim sourceDir As String = txtOrigen.Text Dim backupDir As String = txtDestino.Text Try Dim docList As String() = Directory.GetFiles(sourceDir, "*.*", SearchOption.AllDirectories) ' Copy doc files. For Each f As String In docList 'Remove path from the file name. Dim fName As String = f.Substring(sourceDir.Length + 1) ' Use the Path.Combine method to safely append the file name to the path. ' Will overwrite if the destination file already exists. File.Copy(Path.Combine(sourceDir, fName), Path.Combine(backupDir, fName), True) Next For Each f As String In docList File.Delete(f) Next Catch dirNotFound As DirectoryNotFoundException Console.WriteLine(dirNotFound.Message) End Try MsgBox("Done!") End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.