I am trying to move a file from a location to another using boost::filesystem . I used the boost::filesystem::rename function, but when I try to do this, I have the following error.
terminate called after throwing an instance of 'boost::filesystem::filesystem_error' what(): boost::filesystem::rename: Invalid cross-device link: "./file_A.csv", "/opt/data/file_B.csv" Aborted (core dumped)
I realized that the problem is that I am trying to move a file from one folder to another installed on another volume.
Is there any solution other than
- COPY the file and then DELETE it (this gives me some sense of security).
- wrapping
mv in a call to std::systen ?
Is there any other function in boost::filesystem for what I want to achieve? I can not find it myself.
I work with g ++ and linux.
c ++ linux boost-filesystem
Abruzzo forte e gentile
source share