The easiest way based on what you've got already (and probably the fastest to run) is to create the array array after the "Loop" line (so you know what size it needs to be), then fill it from the collection (and the FileDateTime value), and then sort the array based on the time.
Creating the array will be like this (Variant is safe for String and Date data):
Your "rename the files" section will need to be modified to use the array rather than the collection.Code:Dim arrFiles() as Variant ReDim arrFiles(1, cFiles.Count) as Variant
The arrays articles in the "Data types/Variables" section of the FAQs will be useful.




Reply With Quote