Hi all,
Can FTP stage be used to retrieve the lastest file from a server?
FTP stage to retrieve the lastest file
Moderators: chulett, rschirm, roy
Define 'latest file'.
I'm sure you can make use of the FTP stage for something like this, but since it cannot handle multiple files (or even wildcards as far as I recall) you'll need to know which file you want before you get to the stage in your jobstream.
You'd need to script something to go out to the remote server and find the latest version of the file you are looking for, capture the filename and then pass it into your job as a Job Parameter. While you're there, you might as well script the FTP part as well and 'get' the file at the same time. Then you can simply process the file in your job.
My two cents. I'm sure others will be along with different approaches.
I'm sure you can make use of the FTP stage for something like this, but since it cannot handle multiple files (or even wildcards as far as I recall) you'll need to know which file you want before you get to the stage in your jobstream.
You'd need to script something to go out to the remote server and find the latest version of the file you are looking for, capture the filename and then pass it into your job as a Job Parameter. While you're there, you might as well script the FTP part as well and 'get' the file at the same time. Then you can simply process the file in your job.
My two cents. I'm sure others will be along with different approaches.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You could, in the FTP stage, use a "before" command uniquely to identify the latest file and give it a fixed name that FTP could use. Something like:
then use FTP to get the xyz file
Code: Select all
rm -rf mytempdir && mkdir mytempdir && cp `ls -t | head -1` mytempdir/xyz && cd mytempdir
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.