Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Go Back  Xtreme Visual Basic Talk > > > Simply need to know how to delete a file over FTP


Reply
 
Thread Tools Display Modes
  #1  
Old 08-22-2011, 11:32 AM
wannasee wannasee is offline
Newcomer
 
Join Date: Aug 2011
Posts: 2
Question Simply need to know how to delete a file over FTP


I simply want to be able to delete a file via ftp.
What irritates me is, it is so easy to upload a file but so much harder to delete a file.

Please offer a simple way to delete a file over FTP using visual basic

Thank You in advance for any help offered :P
Reply With Quote
  #2  
Old 08-22-2011, 11:41 AM
AtmaWeapon's Avatar
AtmaWeaponSimply need to know how to delete a file over FTP AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Set the FtpWebRequest's Method property to WebRequestMethods.Delete. As long as you are authenticated as a user that can delete files that should work.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 08-22-2011, 02:52 PM
wannasee wannasee is offline
Newcomer
 
Join Date: Aug 2011
Posts: 2
Default

Look this is my code for uploading
My.Computer.Network.UploadFile("File to Upload", "FTP Server & File", "Username", "Password")

Can anyone plzzz show me how to delete a file via ftp with VB.net
Reply With Quote
  #4  
Old 08-22-2011, 04:48 PM
AtmaWeapon's Avatar
AtmaWeaponSimply need to know how to delete a file over FTP AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

The My.* namespaces are shortcuts for very common tasks. You cannot use them to do everything that classes in the rest of the framework do. Deleting FTP files is one of the things you cannot do with them.

You will have to create an FtpWebRequest and set its Method property as I stated. The documentation has an example with heading, "The following code example demonstrates deleting a file from an FTP server." Microsoft has already showed you how to do it!

Unfortunately it's in C#, and I'm sure your next complaint would be it's in C#. I'm usually mean and say "man up, it's 8 lines, you're not too dumb to figure out what 'variable = value;' means." Today I feel generous; here's a translation you'll still have to use a bit of brain power to decipher:
Code:
Dim eltonJohn As String = "ftp://your server"

Dim ping as FtpWebRequest = CType(WebRequest.Create(eltonJohn), FtpWebRequest)
ping.Method = WebRequestMethods.Ftp.DeleteFile

Dim pong As FtpWebResponse = CType(ping.GetResponse(), FtpWebResponse)
Console.WriteLine("Delete status: {0}", pong.StatusDescription)
pong.Close()
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
 
Simply need to know how to delete a file over FTP
Simply need to know how to delete a file over FTP
 
-->