probleum in doing copy of folders according to Index file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veer
    New Member
    • Jul 2007
    • 198

    probleum in doing copy of folders according to Index file

    hi
    it looks a silly question but i m getting confused actually i want to copy folders from one location to another like from C:\abc To D:\xyz here abc and xyz are two folders in c and d drive
    it works fine when whole folder including sub folders of "abc" are to be copied into "xyz" folder
    but i have a index file "index.xls" which contain some folder names and i want to copy only those folders whose names are present in index file

    i used the following coding for coping the whole folders which works fine

    Public Sub CopyDirectory(B yVal strSrc As String, ByVal strDest As String)
    Dim dirInfo As New System.IO.Direc toryInfo(strSrc )
    Dim fsInfo As System.IO.FileS ystemInfo

    For Each fsInfo In dirInfo.GetFile SystemInfos
    Dim strDestFileName As String = System.IO.Path. Combine(strDest , fsInfo.Name)
    If TypeOf fsInfo Is System.IO.FileI nfo Then
    System.IO.File. Copy(fsInfo.Ful lName, strDestFileName , True)
    Else
    CopyDirectory(f sInfo.FullName, strDest)
    End If
    Next
    end sub

    but i am not getting the idea how to copy only those folders whose names are present in index .xls file
    please give some idea . i opend the excel file and getting the folders name from the file but after i got confused
    pleaseeeeeeeeee es give some idea
    varinder
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Load the folder names from excel into a string array or list, and then loop through that, using each name to create a DirectoryInfo.

    Comment

    Working...