hi
I am working in asp.net,vb.net
I have to copy all files from 1 folder to another folder through coding using system.io

the files in the new folder should remain with the same name

how to do this.

For Each f In Directory.GetFiles(sourcefolderpath)

file.copy(f,destination path)
Next

thank you

hi
I am working in asp.net,vb.net
I have to copy all files from 1 folder to another folder through coding using system.io

the files in the new folder should remain with the same name

how to do this.

--------------------------------------------------------------------------------

Here is VB code

imports System.io

  Public Shared Sub CopyFlashScriptFile(ByVal SourceDirectory As String, ByVal DestinationDirectory As String)
            Try
                Dim f() As String = Directory.GetFiles(SourceDirectory)
                For i As Integer = 0 To UBound(f)
                    File.Copy(f(i), DestinationDirectory & "\" & fileNameWithoutThePath(f(i)))
                Next
            Catch ex As Exception
            End Try
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.