Blog

Multiple File Transfer One Location To Another Location VB.Net

Posted by Amit Patel Blogs | Visual Basic .NET Oct 22, 2012
This Code for change file location to any another location.
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
comments
COMMENT USING
PREMIUM SPONSORS
Nevron Software is a global leader in component based data visualization technology for a diverse range of Microsoft centric platforms. Nevron Data Visualization components are used by many companies, educational and government organizations around the world.
Nevron Chart
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Nevron Chart