Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 5th, 2007, 12:02 PM
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to delete file System.IO.Delete error maricar C# 13 March 14th, 2014 06:50 AM
ftp file upload yugi9966 ADO.NET 1 August 7th, 2008 09:09 AM
vb6 subroutine to ftp a file? dgr7 VB How-To 2 January 16th, 2007 12:15 AM
progress bar while getting file from FTP Dhodie Pro VB 6 4 October 28th, 2004 10:15 PM
FTP a file with the Windows Shell darinsee Classic ASP Basics 3 July 8th, 2004 04:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.