Checking for a Remote File or Folder (RemoteExists)

Use the RemoteExists method to verify that a remote file or folder exists. BstrName should be the full path.

Syntax

Boolean Object.RemoteExists(BSTR bstrName)

Return Values

true

File or folder does exist

false

File or folder does not exist

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

'Initialize all necessary fields for MySite : host name, user, password, etc.

R = MySite.RemoteExists( "/pub/user/file.txt")

If (R) Then

MsgBox "File exists on remote side"

Else

MsgBox "File doesn't exist on remote side"

End if

If using an "if not" conditional, use CBool instead of boolean as the return type.

Correct:

if not CBool(MySite.RemoteExists(strRemote)) then

MsgBox "Error! " & MySite.ErrorDescription

Incorrect:

if not MySite.RemoteExists(strRemote) then

MsgBox "Error! " & MySiteErrorDescription