Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-09-14
1
Medium Priority
?
952 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 2000 total points
ID: 33676879
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

688 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