View Single Post
  #1 (permalink)  
Old April 5th, 2007, 12:02 PM
dgr7 dgr7 is offline
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default FTP attempt to delete a file *only* if it already

hello,
I have this below .vbs script code that I use to delete two files from an FTP site. Sometimes one or both of the below files (LTRDOWN01 and CABCALLS.txt) doesn't exist, so that when the vbs code is executed an error occurs. How can I modify the code so that each Remove statement is executed *only* if the file exists?
thanks in advance,
david
------------------
Code:
' VBS Script Generated by CuteFTP (TM) macro recorder.
' Generated, then edited: 02/07/07 by dgr.

' Create TEConnection object
Set MySite = CreateObject("CuteFTPPro.TEConnection")

' Initialize remote server host name, protocol, port, etc.
MySite.Host = "192.168.1.1"
MySite.Protocol = "FTP"
MySite.Port = 21
MySite.Retries = 34
MySite.Delay = 7
MySite.MaxConnections = 4
MySite.TransferType = "ASCII"
MySite.DataChannel = "DEFAULT"
MySite.AutoRename = "OFF"
' WARNING!!! SENSITIVE DATA: user name and password.
MySite.Login = "****"
MySite.Password = "***"
MySite.SocksInfo = ""
MySite.ProxyInfo = ""
' Connect to remote server
MySite.Connect
MySite.RemoteRemove "/u/sting/tapefiles/LTRDOWN01"
MySite.RemoteRemove "/u/sting/tapefiles/CABCALLS.txt"
MySite.Disconnect
Reply With Quote