Solved

How to tell if file exists before deletion via FTP vb.net

Posted on 2010-09-14
1
951 Views
Last Modified: 2012-05-10
Hi

I use the code below to delete files on my server via FTP. How can I tell if the file exists before I attempt to delete it? I am using vb.net 2008

strFileName = "ftp://" & strFTPAddress & "/" & strFTPImageFolder & "/" & intInvNum & "-1.jpg"
            Dim clsRequest1 As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(strFileName), System.Net.FtpWebRequest)
            clsRequest1.Credentials = New System.Net.NetworkCredential(strFTPUserName, strFTPPassword)
            clsRequest1.Method = System.Net.WebRequestMethods.Ftp.DeleteFile
            Dim ftpResp1 As FtpWebResponse = clsRequest1.GetResponse

Thanks

Nick Steele

0
Comment
Question by:nsteele84
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
whityum earned 500 total points
ID: 33676879
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question