I have a requirement to pick up a group of files - exact number unknown but it can be anywhere from zero to 500+ for each run - via ftp. Since we have no way of knowing whether a file is still being generated (i.e., just the directory listing exists, no content) my plan is to process as follows:
1. FTP connect, copy all files in the pickup directory to my local server and disconnect.
2. Sort the directory list to find the latest file date/time - only one file at a time is being generated so this one should be the only one in question - and eliminate it from the list.
3. Using the list of files from #2, reconnect to the source server and delete those files. Since I already have a copy of them, I want the originals to go away so they're not present for the next run.
My problem is this - while I can easily use a foreach command in .ksh to process each file in my list one at a time, I don't want to make possibly hundreds of separate ftp connections to delete the files I've copied (other than the last one as explained above). I can't just do an mdel because other files are/may be generating during this process and I won't have copies of them.
So the question (finally) ... is there a way to perform step #3 above in one ftp connection or do I just have to deal with the multiple connections to delete the files I'm processing?
System is AIX v5.6, Korn Shell, standard Unix ftp connections/commands.
Thanks in advance!
Tom
"My mind is like a steel whatchamacallit ...
1. FTP connect, copy all files in the pickup directory to my local server and disconnect.
2. Sort the directory list to find the latest file date/time - only one file at a time is being generated so this one should be the only one in question - and eliminate it from the list.
3. Using the list of files from #2, reconnect to the source server and delete those files. Since I already have a copy of them, I want the originals to go away so they're not present for the next run.
My problem is this - while I can easily use a foreach command in .ksh to process each file in my list one at a time, I don't want to make possibly hundreds of separate ftp connections to delete the files I've copied (other than the last one as explained above). I can't just do an mdel because other files are/may be generating during this process and I won't have copies of them.
So the question (finally) ... is there a way to perform step #3 above in one ftp connection or do I just have to deal with the multiple connections to delete the files I'm processing?
System is AIX v5.6, Korn Shell, standard Unix ftp connections/commands.
Thanks in advance!
Tom
"My mind is like a steel whatchamacallit ...