Jump to content

Recommended Posts

Posted

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

Guest Serpentine
Posted (edited)

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
Posted

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.

Posted

Sorry I don't know the answer, but welcome to the forums. I'm sure somebody around here will be able to help.

Posted

Welcome to the forums, ATY! :)

 

I looked at the link Serpentine provided - it appears to me that if you don't know the file name(s), you'd first need to retrieve a directory listing with GetList, then you could download whatever filenames appear in the listing.

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...