Modern C++ idoms and recipes
meshell
12K views
Filesystem library
An important addition to the C++17 standard is the filesystem library. The filesystem library is based on boost::filesystem and enables us to work with paths, files and directories.
The current compilers (gcc 7.2. is used for this exercise) provide an implementation of the library in the std::experimental::filesystem
namespace and the actual header is <experimental/filesystem>
.
Implement a program that searchs in the 'data' directory of the current directory for all files which contain 'copy' in its content and copy them to a new folder 'data_new'.
1
2
3
4
5
6
7
8
9
10
#include <experimental/filesystem>
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
namespace fs = std::experimental::filesystem;
using namespace std::string_literals;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD Online Participants