1

Hello everyone !!!

I recently designed a web application using VB.Net and tried to copy a folder (containing multiple files) from one disk drive to another but unfortunately I didn't succeed.
I tried using a file upload but that is only for single/multiple file selection however I want to select a complete folder instead of multiple files.
Please help if anyone knows as it is a real urgent task for me to accomplish.

Thank you very much in advance.

2
Contributors
4
Replies
7
Views
4 Years
Discussion Span
Last Post by KM499
Featured Replies
  • Do you mean something like this? Try Dim myDir As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "/tmpOldLoc/" Dim toDir As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "/tmpNewLoc/" If Directory.Exists(myDir) = True Then Dim di As New IO.DirectoryInfo(myDir) Dim diar1 As IO.FileInfo() = di.GetFiles() Dim dra As IO.FileInfo For Each dra In diar1 File.Copy(dra.FullName, toDir … Read More

  • 1

    Thanks a lot Begginnerdev. Read More

  • Np friend, anything else I can help you with? Read More

1

Do you mean something like this?

    Try
        Dim myDir As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "/tmpOldLoc/"
        Dim toDir As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "/tmpNewLoc/"


        If Directory.Exists(myDir) = True Then
            Dim di As New IO.DirectoryInfo(myDir)
            Dim diar1 As IO.FileInfo() = di.GetFiles()
            Dim dra As IO.FileInfo
            For Each dra In diar1
                File.Copy(dra.FullName, toDir & dra.Name)
            Next
        End If

    Catch ex As Exception

        MsgBox("Something went wrong!" & vbCrLf & ex.Message)

    End Try
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.