how to sort the files in the directory based on the part of the file name?
File format:
prod_orders_XXX_<TimeStamp>.datXXX = symbol of the product and the length may varies.
<TimeStamp> = date and time
Multiple files for the same XXX are possible with different time stamps.
Here are some examples:
prod_orders_abc_20122001083000.dat
prod_orders_abc_20122007083111.dat
prod_orders_xyz_20122003093157.dat
prod_orders_xyz_20122001083000.dat
prod_orders_abc_20122001163139.dat
prod_orders_abc_20122002093137.dat
prod_orders_xyz_20122001183000.dat
prod_orders_abc_20122001163139.dat
prod_orders_abc_20122001093137.dat
I need to sort the files based on the time stamp mentioned as part of file name.
Sorry for not providing a VB answer, but it can't be hard to convert it to VB.NET The following code will stort the array by the timestamp.
UPDATE: VB version of the same code.
This should do what your looking for. You'll need to make sure the Date format is correct (I guessed it..) and add some extra validation.
Edit, sorry just noticed you wanted to sort them all...
End Module