Jump to content

Remoteexists


Recommended Posts

Hi all,

First of all, sorry for my crappy English, It's my second language.

I am new to this forum and Cuteftp pro.

Anyway, I tried to write a script to download files from a server to my local PC. Filename are variable. How could i verify if files are existing? Below is the codes. Thanks for your help.

 

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Protocol = "FTP"

MySite.Host = "xxx.xxx.xxx.xxx"

MySite.Port = 21

MySite.Login = "test"

MySite.Password = "test"

MySite.Connect

 

R=Mysite.localExists ("/test/from/*.txt")

If ® Then

'msgbox "file exist" 'test if the file exists

MySite.Download "/test/from/gcs*", "c:\data"

Else

'''Msgbox "File doesn't exist1 on client site"

Set objEmail = CreateObject("CDO.Message")

objEmail.From = "xxxx@hotmail.com"

objEmail.To = "xxx.xxx@xxx.com"

objEmail.Subject = "test"

objEmail.Textbody = "test"

objEmail.Send

 

End if

Link to comment
Share on other sites

Guest Serpentine

Have you tried

 

Set MySite = CreateObject("CuteFTPPro.TEConnection")

MySite.Protocol = "FTP"

MySite.Host = "xxx.xxx.xxx.xxx"

MySite.Port = 21

MySite.Login = "test"

MySite.Password = "test"

MySite.Connect

 

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

 

If ® Then

 

MsgBox "File exists on remote side"

MySite.Download "/test/from/gcs*", "c:\data"

 

 

Else

 

MsgBox "File doesn't exist on remote side"

Set objEmail = CreateObject("CDO.Message")

objEmail.From = "xxxx@hotmail.com"

objEmail.To = "xxx.xxx@xxx.com"

objEmail.Subject = "test"

objEmail.Textbody = "test"

objEmail.Send

 

End if

 

Note, I just combined what you gave with what I found at this site.

 

Your English is better than most of the people I know.

Edited by Serpentine
Link to comment
Share on other sites

Serpentine,

Yes i had tried the code below. This work only if you know the exactly file name

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

 

But in my case, I don't know the file name...

 

Thank you all for quick response.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...