process one file at a time [message #309204] |
Wed, 26 March 2008 15:27 |
shree_z
Messages: 75 Registered: February 2008
|
Member |
|
|
I have a Unix program which looks for particular files by their names say A*.txt,in a directory and then process the files.
here is the part of the code.
ls -lrt A*.txt | awk '{print $9}' | while read fname
do....
...
done
I have registered this as a host concurrent program in Apps.
As of now, the program looks for all A*.txt and processes all of them.
But I have a change request, that needs this program to be scheduled to run every one hour or so and process only one file at a time.
The problem here is, if there are more than one file with the same naming convention, which file would the program choose to process?
If the name of the file includes date and time, is there a way to modify the batch program so that it chooses the latest file to process? If yes, could anyone please tell me how this can be done..
Thanks in advance
|
|
|
|
|
|
|