> Error: Index was outside the bound of array.
_sPath() is probably empty (you get folders inside "C:\Users\%UserName%\sDirectory"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
With following code, I am trying to copy a directory (_sPath) with all files and subdirectories to another folder (_dpath).
Dim _sPath() As String = IO.Directory.GetDirectories(IO.Path.Combine("C:\Users", Environment.UserName, "sDirectory"))
Dim _dPath() As String = IO.Directory.GetDirectories(IO.Path.Combine("C:\Users", Environment.UserName, "dDirectory"))
My.Computer.FileSystem.CopyDirectory(_sPath(0), _dPath(0), overwrite:=True)
Error: Index was outside the bound of array.
All I need is to copy a folder with ALL it's contents to another directory as in CMD:
xcopy C:\Users\%UserName%\sFolder C:\Users\%UserName%\dFolder\ /H /E /C /I /Y /Q
> Error: Index was outside the bound of array.
_sPath() is probably empty (you get folders inside "C:\Users\%UserName%\sDirectory"