#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
using namespace std;
using namespace boost;
int main()
{
boost::filesystem::path src("/usr/BoostCode/1.txt");
boost::filesystem::path dst("/usr");
boost::filesystem::copy_file(src, dst);
}
What i want to do is: copy the file “1.txt” from “/usr/BoostCode” directory to “/usr”
Compiling: g++ bfs.cpp -lboost_system -lboost_filesystem -o bfs
To Run: ./bfs
Getting an error: terminate called after throwing an instance of ‘boost::exception_detail::clone_impl > > >’
what(): boost::filesystem::copy_file: File exists: “/usr/BoostCode/1.txt”, “/usr”
Aborted
Please help whats wrong with this snippet?
Thanks in Advance
Don’t you have to specify the full destination?