I am trying to move a file from a location to another using boost::filesystem
.
I used boost::filesystem::rename
function but when I try to do that 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 understood that the problem is that I am trying to move a file from one folder into another mounted on a different volume.
Is there any solution different from
- COPYING the file and then DELETE it (it gives me some feeling of security).
- wrapping
mv
in a call tostd::systen
?
Is there any other funciton in boost::filesystem
for what I want to achieve? I cannot find it myself.
I am working with g++ and linux.