arrays - Copying subfolders with their own files to another folder with WebClient in VB.NET -


i'm copying array of subfolders , array of files of subfolders, process successful, files copied has no size. 60 mb file became 0 bytes after being copied directory, wrong?

this code:

dim withevents webcopy new webclient  dim folderstocopy new arraylist() dim filesofsub new arraylist()  private sub button6_click(byval sender system.object, byval e system.eventargs) handles button6.click     folderstocopy.clear()     filesofsub.clear()     dim src string = form2.textbox1.text     dim dest string = form2.textbox2.text      dim di directoryinfo = new directoryinfo(src)     dim dii directoryinfo = new directoryinfo(dest)  ' subfolders , files.      each sd in di.getdirectories         each fi in sd.getfiles             if not directory.exists(dest & "\" & sd.name) , not file.exists(dest & "\" & fi.name)                 folderstocopy.add(sd.name)                 filesofsub.add(fi.name)             end if         next     next  ' create subfolders     = 0 folderstocopy.count - 1         if not directory.exists(dest & "\" & dii.name)             directory.createdirectory(dest & "\" & folderstocopy(i))         end if     next  ' copy files of subfolders     = 0 filesofsub.count - 1         dim webcopy webclient = new webclient          webcopy.downloadfileasync(new uri(src & "\" & filesofsub(i)), dest & "\" & folderstocopy(i) & "\" & filesofsub(i))      next  end sub 

btw, i'm using webclient smooth progress bar , convinient use of handlers.

thank god have found out answer!

webcopy.downloadfileasync(new uri(src & "\" & folderstocopy(i) & "\" & filesofsub(i)), dest & "\" & folderstocopy(i) & "\" & filesofsub(i)) 

this should correct form of downloadfileasync copier.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -