Need to copy files from one directory to another using System.IO.F

  • Thread starter Thread starter OriginalStealth
  • Start date Start date
O

OriginalStealth

I have inherited a .net project. The code needs to copy files from a
directory on our shared drive to a users local drive. The code is below. I
need a "for each" statement or some statement that will copy the files from
the shared location to my local drive. Thanks in advance. OS


Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports Microsoft.Win32
Imports System.Configuration.ConfigurationSettings

Namespace Test

Public Class CopyTest
Private asCommandLineArgs As Array
Private sRunAs As String = System.Environment.UserName

Dim SharedDrive As String = "\\mysharedlocation\folder1"
Dim dirs As System.IO.DirectoryInfo() = New
System.IO.DirectoryInfo(path).GetDirectories()
Dim sLocalDrive As String = ""C:\Program
Files\mylocation\folder1"

Public Sub CopyFiles()

System.IO.File.Copy(sSharedDrive & sFileName, sLocalDrive)


End Sub
End Class
End Namespace
 
Back
Top