Reputation: 9062
When iterating through a directory using std::filesystem::directory_iterator
, are there any guarantees regarding the order of traversal?
Upvotes: 0
Views: 548
Reputation: 180825
The order is unspecified per [fs.class.directory.iterator]/8
The order of directory entries obtained by dereferencing successive increments of a
directory_iterator
is unspecified.
Upvotes: 3
Reputation: 12273
From the docs:
The iteration order is unspecified, except that each directory entry is visited only once. The special pathnames dot and dot-dot are skipped.
Upvotes: 4