how to reset directory iterator to the beginning of the folder

i would like to reset the directory iterator to the beginning of the folder again , after it has reached end to compute the total file size of each extension in the current folder.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  

void scan2(path const& folder)
{
	cout << "\nScanning current folder:\n ";
	directory_iterator dir(folder);									   
	directory_iterator end;		


	
	while (dir != end)
	{
		//cout << dir->path();




         // algorithms and computations here 

	}

	++dir;
	}
	cout << endl;


	dir = folder.begin();


}



dir = directory_iterator(folder); // reset directory iterator to the beginning of the folder
Topic archived. No new replies allowed.