Copy *.* .... ?

  • Thread starter Thread starter Smith Guy
  • Start date Start date
S

Smith Guy

I can move the files in VB.Net 2003 with the following statements.
'Microsoft.VisualBasic.FileSystem.FileCopy
'System.IO.File.Copy
My question here is how to move all the files to particular folder.
Something like copy *.* to some destination.
Thanks,
Smith
 
You would have to use a loop:

Dim sDestination As String = "c:\destinationfolder"
Dim aFiles() As String = Directory.GetFiles("c:\foldername","*.*")
For Each f As String In aFiles
File.Copy(f, sDestination)
Next

Note: This code is from my head. Double check the syntax and method
names.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top