Here's the picture...
Date format: Y%m%d%H%M%S%
This is my filename format: file_sub1_20110501000000.txt
Directory structure:
dir/
sub1/
file_sub1_20110501003000.txt
file_sub1_20110501010000.txt
file_sub1_20110501013000.txt
file_sub1_20110501020000.txt
--more--
sub2/
file_sub2_20110501003000.txt
file_sub2_20110501010000.txt
file_sub2_20110501013000.txt
file_sub2_20110501020000.txt
--more--
--more--/
--more--.txt
My problem is how to efficiently filter out filenames within the range where
($file_date <= $cur_date && $file_date >= $prev_date)
I was thinking to loop through each file while comparing whether the dates are within range but I find the approach too slow when I'm dealing with thousands of files.
Is there a faster way to do it?
Thanks!