Ive written a small function to copy a directory from one dir to another
When I run this on one Fedora 12 machine, it works fine, even for
chinese files and folders.
however, when i run this on Fedora 12 on another machine, it gives me
Boost::filesystem::copy_file: Invalid Argument: "/mnt/pd1/??Microsoft
Word ??.doc"."/mnt/pd/??Microsoft Word ??.doc"
Why? is the machine missing any package? Please help
Here is the code:
#include <iostream>
#include
#include <cstdio>
#include <string>
using namespace std;
struct dir
{
int file_count;
int total_size;
};
void copy_dir(string src, string dest);
int main()
{
copy_dir("/media/disk", "/media/disk-1");
return 0;
}
void copy_dir(string src, string dest)
{
boost::filesystem::path psrc(src);
boost::filesystem::path pdest(dest);
if(!boost::filesystem::is_directory(psrc) ||
!boost::filesystem::is_directory(pdest))
{ cerr<<" Source and Destination are not directories "<leaf();
boost::filesystem::path to(to_path);
if(is_regular(from) && !boost::filesystem::exists(to) )
{
cerr<<"Copying "<