'How to move files from folder to another using the paths listed in a ListBox

I have a list box that has paths to files. How can I move the selected file items that have the paths to another folder?



Solution 1:[1]

You can do it like this :

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    For Each SelectedItem In ListBox1.SelectedItems
        Try
            File.Move(SelectedItem.ToString(), "New path here")
        Catch : End Try
    Next
End Sub

And with error handling, so if a file is not accessible it will continue to the next one.

Hope that helped you :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mousa Alfhaily