Hi all,

 

I’m revisiting boost::filesystem::path after not using it for a while and wondered whether there is a way to remove parts of a path deeper than a specific directory?

 

By way of an example, assume I have the following path declared:

boost::filesystem::path path =”d:\\test1\\test2\\test3.txt”

 

what I want to do is determine whether test2 exists as part of the path and if it does remove everything after and including the found part of the path, so in this case \\test2\\test3.txt would be removed.

 

I could do it by converting the path to a string, but wondered whether boost::filesystem could do this natively in some way.

 

Any help appreciated.

 

Kind regards

Sean.