I am attempting to backing up a user profile (or more accurately copying specific directories e.g. username\documents, username\desktop, etc.) to a network shared drive. I'm using C++ builder (10.1 starter), thus limited to boost 1.55.
I've found this copyDir method by nijansen but it has an issue: it "breaks" when attempting to copy to a directory that already exists because of this code:
if(fs::exists(destination))
{
std::cerr << "Destination directory " << destination.string()
<< " already exists." << '\n';
return false;
}
Obviously I could just change it to delete directory if exists, then rather than returning instead let it proceed with copying, but I'm looking for a bit more.
What I would like to do is mirror the directories from the original to the backup (like robocopy's /MIR flag (including subdirectories)). If I backup a user today, then they delete a few things, create a few more, edit a document, etc., I want to copy just those changes into tomorrow's backup (and not re-backup everything that didn't change). Some users have 50+ GB of data which would take entirely too long if I were to just delete their "yesterday's" backup folder and create an entirely new backup.
Summary: Is there a way to mirror (not just copy!) directory trees between a source and destination using BOOST?
Any help and/or examples would be greatly appreciated! Thanks in advance!