how to check if the a recursive scan is pointing to the folder from which it started its recursive scan ?
Let's say I am starting my recursive scan at folder C:\test. That is my beginfolder (beginfolder = C:\test)
Then the recursive scan scans some other folders such as C:\test\folder1.
after it is done scanning C:\test\folder1 , it continues scanning at the folder
C:\test again.( because a recursive scans scans all the files in folder alphabetically)
How do i check that the folder path that the dir is pointing to is equal to "C:\test again ?
"the current folder that dir is pointing to is not the beginfolder"
i would like to have set some condition where the current folder path that dir is pointing to is not equal to the beginfolder , so if we have a folder path that is anything different from "C:\test" for example a file path name of C:\test\folder1 would satisfy the condition.
To avoid infinite recursion I suggest a common approach:
Use a container (such as std::set).
Before you process a directory search it in the container. If it is not in the container add it and continue processing otherwise nothing has to be done.
i have defined a map which stores the extension of all the files in a folder as the key and a set of parent folder paths which contain the given extension from the key as the value.
I would like to print out this map filesto;
map<path, set<path>> filesto ;
but the problem is that my value of my map is a set.
and the "<<" operator is not defined for the set .
How can i print out the map ? I am not very sure about operator overloading.