Solved

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

Posted on 2010-09-14
1
949 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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