I'm trying to loop through a group of files for processing, but some files may have different versions in the batch and I only need to process the latest version of each one.
I've got an array of filenames (reverse sort):
@stl_files = [
'STL-20120925.01.006_IPSP.CSV',
'STL-20120925.01.006.CSV',
'STL-20120925.01.001_IPSP.CSV',
'STL-20120925.01.001.CSV',
'STL-20120914.01.006.CSV',
'STL-20120914.01.001.CSV'
]
The '001' and '006' in the examples are the version numbers. So as I loop through these files, I need to match against previously checked processed files.
So when the 3rd file comes up, it needs to recognize that it's an earlier version of the 1st file, the 4th is an earler version of the 2nd, and the 6th is an earlier version of the 5th.
I'm thinking as each file is looked at, I'll add it to an array of viewed files. Then there should be some way to use a regexp to to bump the current filename against the viewed filenames, but I'm at a loss of how to do it effeciently. Can someone point me in the right direction?
Thanks,
_________
RottPaws
If you don't report a problem, I probably won't fix it.
I've got an array of filenames (reverse sort):
@stl_files = [
'STL-20120925.01.006_IPSP.CSV',
'STL-20120925.01.006.CSV',
'STL-20120925.01.001_IPSP.CSV',
'STL-20120925.01.001.CSV',
'STL-20120914.01.006.CSV',
'STL-20120914.01.001.CSV'
]
The '001' and '006' in the examples are the version numbers. So as I loop through these files, I need to match against previously checked processed files.
So when the 3rd file comes up, it needs to recognize that it's an earlier version of the 1st file, the 4th is an earler version of the 2nd, and the 6th is an earlier version of the 5th.
I'm thinking as each file is looked at, I'll add it to an array of viewed files. Then there should be some way to use a regexp to to bump the current filename against the viewed filenames, but I'm at a loss of how to do it effeciently. Can someone point me in the right direction?
Thanks,
_________
RottPaws
If you don't report a problem, I probably won't fix it.