Multiple File Transfer One Location To Another Location VB.Net

Multiple File Transfer One Location To Another Location VB.Net

This Code for change file location to any another location.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        On Error Resume Next
        Dim FSO, SourceFolder, OrderFiles, SourcePath, DestinationPath, FolderName
        Dim Counter, CounterLimit
        FSO = CreateObject("Scripting.FileSystemObject")
        SourcePath = "D:\SplitImage\"
        DestinationPath = "D:\SplitImage\test"
        'set the folder in that we have to search the files
        SourceFolder = FSO.GetFolder(SourcePath)
        'get all the Files into the variable OrderFiles
        OrderFiles = SourceFolder.Files
        'File not Exist then File Creation
        If Not FSO.FolderExists(DestinationPath) Then
            FolderName = FSO.CreateFolder(DestinationPath)
        End If
        'Set the counter limit to the number of files that we want to transfer at one go.
        CounterLimit = 50
        Counter = 1
        'Loop for transfer files one by one
        For Each Orderfile In OrderFiles
            If Counter > CounterLimit Then
                Exit For
            End If
            FSO.MoveFile(SourcePath & "\" & Orderfile.Name, DestinationPath & "\")
            Counter = CInt(Counter) + 1
        Next
    End Sub
Ebook Download
View all
Learn
View all