ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
I'm looking to use ScriptFTP with an ftp server that will have an
unknown number of files for me to pick up named abc322xx.txt, where xx is a
sequential counter.

Is there a way with your software to use a wildcard to copy them all from
the remote to my local?

During this wildcard copy is there a way to concatenate the abc322xx.txt
files into one file on the local side?

Thanks for your help.
Last edited by mcmahon on 20 Aug 2008, 18:11, edited 1 time in total.
Hello John,

I've written a script for your case. Please, test it and let me know
if it fits your needs.
Code: Select all# Settings $ftpserver="127.0.0.1" $ftpuser="carl" $password="123456" $destination_directory="D:\destination_dir" # Connect to FTP server OPENHOST($ftpserver,$ftpuser,$password) # Change current local directory LOCALCHDIR($destination_directory) # Retrieve remote file listing and store it in $remote_file_list GETLIST($remote_file_list,REMOTE_FILES,"abc322*.txt") # For each element in the file list do the following FOREACH $file IN $remote_file_list     # Download the file     GETFILE($file)     # Append the contents of the file to dest_file.txt     EXEC("type ".$file." >> dest_file.txt") END FOREACH # Close the connection with the FTP server CLOSEHOST
I was able to give this a quick test and it worked well, but they only had 2
files out there for me to pick up. I will contact them in the morning and
ask them to put a larger quantity of files out there to test the script.

I have not read much of the documentation yet and am sure there will be a
way to do this, but I might as well ask you for a quicker answer. I'd like
the final file (which contains all of the files downloaded) to be named
"fulltext.txt" - how do I add that to the script you sent me?
Hi John,

Just replace this line:
Code: Select allEXEC("type ".$file." >> dest_file.txt")
With the following:
Code: Select allEXEC("type ".$file." >> fulltext.txt")
This seemed to give me what I want, but I got an error message for each file
it downloaded. I didn't get a good look at the error, but I think it said
something about TYPE and #12011.

Any ideas?
Could you send me the complete script output? I have to see which
command caused the error. Also, put this command on the top of the
script
Code: Select allVERBOSE(ON)
This way ScriptFTP will generate a more detailed
output.

You can also try putting this command on the top of your script
Code: Select allSETPASSIVE(DISABLED)
It changes the way the files are transfered between ScriptFTP and the server.
Everything worked perfectly. Thanks for all of your help. Looks like I'll be
spending some time re-writing and testing all of our scripts from our
current software to use with ScriptFTP.