Help with multiple download of files with FTP

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
web_developer
Newbie
Posts: 6
Joined: Sat Mar 17, 2007 11:38 pm

Help with multiple download of files with FTP

Post by web_developer » Sat Mar 17, 2007 11:42 pm

I want to be able to download multiple files from an ftp server, onto a computer without knowing the exact filenames(timestamps at the end).

I tried ftpGetFile>server,user,pass,port,localDir/*.*,remoteDir/*.*... didnt work.

any suggestions?

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Sat Mar 17, 2007 11:57 pm

The help file example says
FTPGetFile>Server,Username,Password,port,Local_Path,Host_Filespec,Mode
or
FTPGetFile>ftp.domain.com,anonymous,[email protected],21,c:\temp\,/pub/*.txt,A

In your provided example, you have Local_Path as "localDir/*.*" - I don't think you should have the *.* in there, and did you really mean "/" or "\" ?.

(The Local_Path can be a full "Dir\Filename.ext", but it would only really be good if you were planning to transfer one individual file and you wanted to save it with a different name).

You also have also not included a Mode.
"Mode can be either A or I, where A represents ASCII transfer mode and I represents binary."

Try changing your line to something more like;
ftpGetFile>server,user,pass,port,localDir\,remoteDir/*.*,I

You can check the output/result of "FTP_RESULT"...
MessageModal>%FTP_RESULT%
(This can quickly help you spot errors such as bad path, invalid login, etc).

web_developer
Newbie
Posts: 6
Joined: Sat Mar 17, 2007 11:38 pm

Post by web_developer » Sun Mar 18, 2007 12:06 am

i checked the %FTP_RESULT%, but it said that that it cant find the local file "localDir/"

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sun Mar 18, 2007 2:37 am

"localdir" and "remotedir" are examples intended to be replaced with real paths that exist on your system. Maybe this example is easier to understand:

FTPGetFile>ftp.domain.com,anonymous,[email protected],21,c:\temp\myfile.txt,/pub/readme.txt,A

web_developer
Newbie
Posts: 6
Joined: Sat Mar 17, 2007 11:38 pm

Post by web_developer » Sun Mar 18, 2007 5:12 am

yes, i was just using that as an example. If I used your example, I would say "c:\temp\" for the local directory, and it says that it cannot find file "c:\temp\" :(

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Sun Mar 18, 2007 5:36 am

web_developer wrote:i checked the %FTP_RESULT%, but it said that that it cant find the local file "localDir/"
I assume you're running this program on a windows based system. Could it be that the entry should say "localDir" instead of "localDir/" ?

Perhaps this may be easier if you post the actual "FTPGetFile" line that you're using. And other than user/password info - maybe also show us the lines such as Let>localDir=c:\blah\blah\

web_developer
Newbie
Posts: 6
Joined: Sat Mar 17, 2007 11:38 pm

Post by web_developer » Mon Mar 19, 2007 5:44 pm

Captive wrote:
web_developer wrote:i checked the %FTP_RESULT%, but it said that that it cant find the local file "localDir/"
I assume you're running this program on a windows based system. Could it be that the entry should say "localDir" instead of "localDir/" ?

Perhaps this may be easier if you post the actual "FTPGetFile" line that you're using. And other than user/password info - maybe also show us the lines such as Let>localDir=c:\blah\blah\
Ok, I dont have access to the script right now, but this is the general idea:
let>localDir=C:\data\backup\Sun\
let>remoteDir=/data/backup/Sun/*.*

ftpGetFile>ftp.somesite.com,username,password,21,localDir,remoteDir,I

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Mar 19, 2007 9:49 pm

Thanks for the clarification. That scheme works perfectly for me. The localDir and remoteDir below are exactly how I entered them.

let>localDir=C:\ftptest\
let>remoteDir=/web/ftptest/*.*

ftpGetFile>ftp.mydomain.com,mylogin,mypassword,21,localDir,remoteDir,I

Grabbed 27 files / 4 megs with no problem.

What version of MacroScheduler are you using? Wildcard ftp is only supported in recent versions.

web_developer
Newbie
Posts: 6
Joined: Sat Mar 17, 2007 11:38 pm

Post by web_developer » Mon Mar 19, 2007 10:09 pm

I am using version 8.1

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Mar 19, 2007 10:34 pm

I think that's the problem. If you read this post it appears to have been new in version 9.

web_developer
Newbie
Posts: 6
Joined: Sat Mar 17, 2007 11:38 pm

Post by web_developer » Mon Mar 19, 2007 10:44 pm

k, thanks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts