C++ code to copy multiple files from a directory to another directory

Hello friends!
I have multiple files in one directory, out of those I sorted some of the files on basis of scoring, I want to put those files to specific folder.
How can I do this using C++ code.


Start by writing a function to copy a file from one place to another. E.g.:
bool copyFile(const string &from, const string &to);
Next you will need to walk through the source directory so you can select the files to copy. This is operating system dependent but you could start by seeing if your OS supports opendir(), readdir() and closedir(). Write code that will go through a directory and print the names of the files.

Finally, replace the code that prints the names of the files with code that copies the file if necessary.
Where do you have the scores? It should be way easier to use a script than to compile C++ for such task.
Topic archived. No new replies allowed.