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.
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.
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
liked Script FTP? Try our other product Email Parser
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?
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:
Just replace this line:
Code: Select all
With the following:EXEC("type ".$file." >> dest_file.txt")
Code: Select all
EXEC("type ".$file." >> fulltext.txt")
liked Script FTP? Try our other product Email Parser
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?
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
output.
You can also try putting this command on the top of your script
command caused the error. Also, put this command on the top of the
script
Code: Select all
This way ScriptFTP will generate a more detailedVERBOSE(ON)
output.
You can also try putting this command on the top of your script
Code: Select all
It changes the way the files are transfered between ScriptFTP and the server.SETPASSIVE(DISABLED)
liked Script FTP? Try our other product Email Parser
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.
spending some time re-writing and testing all of our scripts from our
current software to use with ScriptFTP.
- All times are UTC -