: Any one know or have any FileTransfer code for vb.net :
You might like to check out the following class methods in the online help. Start with System.IO and look at the following methods: System.IO.Directory.Move(source, destination) Moves a whole dir at once System.IO.File.Copy(source, destination) Copies a single file System.IO.File.Move(source, destination) Moves a single file
Also check out MS Knowledge Base Article 306666 titled "HOW TO: Recursively Search Directories by Using Visual Basic .NET" at http://support.microsoft.com/default.aspx?scid=kb;en-us;306666 See the section titled "Directory Recursion" and just substitute System.IO.File.Copy or System.IO.File.Move methods as above.
Example from the article:
This copies files from a folder and its sub-folders into the specified destinationPath (note: it does not recreate sub-folders):
Sub DirSearch(ByVal sDir As String, destinationPath as String) Dim d As String Dim f As String
Try For Each d In Directory.GetDirectories(sDir) For Each f In Directory.GetFiles(d, txtFile.Text) File.Copy(f, destinationPath) Next DirSearch(d, destinationPath) Next Catch excpt As System.Exception Debug.WriteLine(excpt.Message) End Try End Sub
Hope its enough for you to get the idea and get started. 'System.IO.Directory.Move' is the simplist method if you're looking for a quick answer, but it obviously deletes the source files.
Comments
:
You might like to check out the following class methods in the online help. Start with System.IO and look at the following methods:
System.IO.Directory.Move(source, destination) Moves a whole dir at once
System.IO.File.Copy(source, destination) Copies a single file
System.IO.File.Move(source, destination) Moves a single file
Also check out MS Knowledge Base Article 306666 titled "HOW TO: Recursively Search Directories by Using Visual Basic .NET" at
http://support.microsoft.com/default.aspx?scid=kb;en-us;306666
See the section titled "Directory Recursion" and just substitute System.IO.File.Copy or System.IO.File.Move methods as above.
Example from the article:
This copies files from a folder and its sub-folders into the specified destinationPath (note: it does not recreate sub-folders):
Sub DirSearch(ByVal sDir As String, destinationPath as String)
Dim d As String
Dim f As String
Try
For Each d In Directory.GetDirectories(sDir)
For Each f In Directory.GetFiles(d, txtFile.Text)
File.Copy(f, destinationPath)
Next
DirSearch(d, destinationPath)
Next
Catch excpt As System.Exception
Debug.WriteLine(excpt.Message)
End Try
End Sub
Hope its enough for you to get the idea and get started.
'System.IO.Directory.Move' is the simplist method if you're looking for a quick answer, but it obviously deletes the source files.