|
-
May 9th, 2010, 03:38 PM
#1
Thread Starter
Member
[RESOLVED] FTP: Create Directory
Thanks to this thread I found out about a very straightforward way in VB 2010 to upload & download files via FTP (shown below). What is the most straightforward way to create a directory on my FTP server, delete a file on the server, and check for a file or directory's existence on the server, please?
I didn't see anything in the intellisense that seems to correspond to these tasks, and the articles I'm finding via Google etc all seem to have fairly lengthy solutions for these sorts of tasks, and the upload/download tasks as well. The existence of such a compact solution in VS 2010 for the latter tasks makes me suspect that there may be something similar for the former as well, but I've not located it yet.
Many thanks,
H.B.
Code:
Dim FileOnServer As String = "ftp://ftp.mydomain.com/subdir/myfile.txt"
Dim LocalFile As String = "C:\FTP_Test_result.txt"
Dim UserName As String = "[email protected]"
Dim Password As String = "mypassword"
If My.Computer.FileSystem.FileExists(LocalFile) Then
My.Computer.FileSystem.DeleteFile(LocalFile)
End If
My.Computer.Network.DownloadFile(FileOnServer, LocalFile, UserName, Password)
-
May 9th, 2010, 06:28 PM
#2
Re: FTP: Create Directory
You'll need to use an FtpWebRequest and FtpWebResponse for that. Start by reading the documentation for those classes to see how they work and what members they have. You can then search this form and the VB.NET CodeBank forum for examples. If you have any specific issues then post back with what you've done and where you're stuck.
-
May 9th, 2010, 06:33 PM
#3
Thread Starter
Member
Re: FTP: Create Directory
Cool, thanks -- I'll pursue that. I'd seen FTPWebRequest, but from the documentation I saw on it I wasn't sure that it was what I needed, or at least not the simplest way to go about it. I'll go deeper into that now.
Thanks for pointing me in the right direction!
HB
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|