Solved

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

Posted on 2010-09-14
1
941 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
1 Comment
 
LVL 7

Accepted Solution

by:
whityum earned 500 total points
ID: 33676879
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now