Switch to filesystem

remove all these ancient c methods and replace them with <filesystem> or boost::filesystem