I have been trying for hours to copy a directory and all it's subfolders and files to another location. There must be an easier way to do this as I have been looping through all the directory's subfolders trying to parse the address of the directory to copy it to a new location in the same sub folder. To prove I have been working on it, here is some unfinished code, it's absolute garbage and does not even work.
Dim x As Integer While x <> globdir.Length For Each f As FileInfo In globdir(x).GetFiles() Console.WriteLine("COPYING " & f.Name & "...") Try 'File.Copy(par(0) & "\" & f.Name, par(1) & "\" & famdir.Name & "\" & f.Name) Console.WriteLine("DONE!") Catch Console.WriteLine("FAILED!") End Try Next Console.WriteLine("COPYING " & globdir(x).Name & "...") Try Dim splt() As String = globdir(x).FullName.Split(":") Dim splt2() As String = par(1).Split(":") Directory.CreateDirectory(par(1) & splt(1)) Console.WriteLine("DONE!") Catch Console.WriteLine("FAILED!") End Try For Each Dir As DirectoryInfo In globdir(x).GetDirectories globdir(globdir.Length + 1) = Dir Next x += 1 End While 'For Each d As DirectoryInfo In famdir.GetDirectories 'Next inputcheck() End Sub
That is a headache half finished sub that I will finish if there is no other way... Help? :)
This post has been edited by peter100191: 04 February 2010 - 09:36 PM