- #1
- 3
- 1
I'm working on a program which copies pdf's from one directory to another using boost filesystem. My problem is that the directory I'm grabbing files from contained about 14000 files (not including files in sub-directories). So iterating through each one to find something isn't very practical.
I just started using the library, so I don't know the ins and outs. As far as I can see, the only way to get information from the directory is through the directory iterators (and I believe it automatically sorts entries in alphanumeric order from what I've seen). I've thought about incrementing the iterator by something more than 1, but anything I read about when doing that (for iterators in general) warns against trouble when it gets close to the end.
My initial plan was to keep breaking all the directory entries into smaller segments to find what I'm looking for. IE: jump to the middle entry between 2 limits, compare that filename with what I'm looking for, then split the appropriate segment into half again. Then keep going until it's found. I'm not sure if something like this is even possible, or suggested when using iterators. So if anyone has any suggestions or ideas, I'm open to hearing them.
Thanks,
Peter
I just started using the library, so I don't know the ins and outs. As far as I can see, the only way to get information from the directory is through the directory iterators (and I believe it automatically sorts entries in alphanumeric order from what I've seen). I've thought about incrementing the iterator by something more than 1, but anything I read about when doing that (for iterators in general) warns against trouble when it gets close to the end.
My initial plan was to keep breaking all the directory entries into smaller segments to find what I'm looking for. IE: jump to the middle entry between 2 limits, compare that filename with what I'm looking for, then split the appropriate segment into half again. Then keep going until it's found. I'm not sure if something like this is even possible, or suggested when using iterators. So if anyone has any suggestions or ideas, I'm open to hearing them.
Thanks,
Peter