469,613 Members | 1,355 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

probleum in doing copy of folders according to Index file

198 100+
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(ByVal strSrc As String, ByVal strDest As String)
Dim dirInfo As New System.IO.DirectoryInfo(strSrc)
Dim fsInfo As System.IO.FileSystemInfo

For Each fsInfo In dirInfo.GetFileSystemInfos
Dim strDestFileName As String = System.IO.Path.Combine(strDest, fsInfo.Name)
If TypeOf fsInfo Is System.IO.FileInfo Then
System.IO.File.Copy(fsInfo.FullName, strDestFileName, True)
Else
CopyDirectory(fsInfo.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
pleaseeeeeeeeeees give some idea
varinder
Sep 26 '08 #1
1 1174
Curtis Rutland
3,256 Expert 2GB
Load the folder names from excel into a string array or list, and then loop through that, using each name to create a DirectoryInfo.
Sep 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by jerrygarciuh | last post: by
2 posts views Thread by Jeff | last post: by
1 post views Thread by =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.