Hello,
Currently This displays all of the files that are in the Folder "Granite" Which are videos in Listbox1 & Listbox2. I want to make it so that only selected objects in listbox1 will be copyed with the same name but have a underscore at the beginning (_). Currently it all works but copy's all files listed in the listbox1 and not selected. Selection Mode is set to MultiSimple.
Also, I want it so that when I press copy it repopulates listbox2 with all the new files (Clears and then displays current Files) but it just stacks it after all items that are already in there. Or I want it so that no matter what it is always checking and syncing to the folder. One or the other.This does not workLastly, All Files that have been copied to the Underscore format cant be copied again it just makes the program fail. I want it so that even if the file was _FILE1 and if it is copied again it would look like this: __FILE1Code:ListBox2.Items.Clear()
Current Code:
Code:Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim directory1 = "C:\Server Media\Granite" Dim files() As System.IO.FileInfo Dim dirinfo1 As New System.IO.DirectoryInfo(directory1) files = dirinfo1.GetFiles("*", IO.SearchOption.AllDirectories) For Each file In files ListBox1.Items.Add(file) Next Dim directory2 = "C:\Server Media\Granite" Dim files2() As System.IO.FileInfo Dim dirinfo2 As New System.IO.DirectoryInfo(directory2) files2 = dirinfo2.GetFiles("*", IO.SearchOption.AllDirectories) For Each file In files ListBox2.Items.Add(file) Next End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click For Each o As Object In ListBox1.Items 'My.Computer.FileSystem.DeleteFile("C:\Server Media\WVII Playback\" & o.ToString) My.Computer.FileSystem.CopyFile("C:\Server Media\Granite\" & o.ToString, "C:\Server Media\Granite\" + "_" & o.ToString) Next Dim directory1 = "C:\Server Media\Granite" Dim files() As System.IO.FileInfo Dim dirinfo1 As New System.IO.DirectoryInfo(directory1) files = dirinfo1.GetFiles("*", IO.SearchOption.AllDirectories) For Each file In files ListBox2.Items.Add(file) Next End Sub




Reply With Quote
