I need some help getting my head around this.
300-1C6SHFHT5MN654321-08030010.txt
300-1C6SHFHT5MN654321-08030015.txt
300-1C6SHFHT5MN654321-08030025.txt
300-1C6SHFHT5MN654321-08030035.txt
300-1C6HJTFM4ML223344-07040010.txt
300-1C6HJTFM4ML223344-07040020.txt
300-1C6HJTFM4ML223344-07040030.txt
300-1C6HJTFM4ML223344-07040040.txt
300-2C4RC1DG2LR111332-05010025.txt
300-2C4RC1DG2LR111332-05010020.txt
300-2C4RC1DG2LR111332-05010010.txt
300-2C4RC1DG2LR111332-05010005.txt
300-1C6RT7LT6MS544775-01010105.txt
300-1C6RT7LT6MS544775-01010110.txt
300-1C6RT7LT6MS544775-01010115.txt
300-1C6RT7LT6MS544775-01010120.txt
Imagine all the above .txt files in a folder all jumbled up There could be thousands of files in this folder.
I'm trying to figure out the best way to sort and move the files per VIN I was thinking that I could loop through the folder, group all the similar VINs, then take the lowest number
Thinking about looking at at each file, looking at left(22), then looking at the group, and moving the (min/lowest) file number (last8) ...then moving to the next VIN grouping
So, perhaps having a batch file look at the four "300-1C6SHFHT5MN654321-" files and then moving the "08030010.txt" over to a processing folder
The .bat will be scheduled to run every five minutes
In the above example, these four files would be moved on the first run:
300-1C6SHFHT5MN654321-08030010.txt
300-1C6HJTFM4ML223344-07040010.txt
300-2C4RC1DG2LR111332-05010005.txt
300-1C6RT7LT6MS544775-01010105.txt
In five minutes, the 2nd run would move these:
300-1C6SHFHT5MN654321-08030015.txt
300-1C6HJTFM4ML223344-07040020.txt
300-2C4RC1DG2LR111332-05010010.txt
300-1C6RT7LT6MS544775-01010110.txt
Any help is appreciated. Thanks!
First time poster. I love this site...has helped me a bunch over the years
Note: I cannot use file date/timestamps. I need the minimum file creation number per VIN