I have a situation where several files may accumulate a folder for some processing and the processing routine can only handle one file at a time, and it must have a specific filename.
I need to be able to find the oldest file in this directory and rename it to the required input filename. Once processed this file gets deleted so I'd have the procedure keep renaming the oldest between processing until all files were exhausted.
In a folder I have:
file1 created 1 Mar file2 created 2 Mar file3 created 3 Mar …
The script would have to rename the file created March 1st to 'input.dat'. On the next occurrence it would rename the one from March 2nd, etc...
How would I go about doing this?