0

I have a directory full of files named foo-1.ocf foo-2.ocf bar-1.ocf bar-2.ocf file-1.ocf file-2.ocf I want to iterate over each pair of files, if bot files exist (-1.ocf and -2.ocf). What is a good approach to do this in boost?

tzippy
  • 6,458
  • 30
  • 82
  • 151

1 Answers1

1
  1. Obtain a sorted list of files, here's a tutorial.

  2. Run through that list remembering (a) if the previous file had suffix -1 and (b) the prefix of the previous file.

  3. So if current file has the same prefix as the previous, and the previous file had suffix -1, and current file has suffix -2 - then you got another pair of files.

Anton Savin
  • 40,838
  • 8
  • 54
  • 90