- Path::mkpath(copy.src.subpath(0, copy.src.size()-1), 0755);
- unlink(copy.dest.str().c_str());
+ Path::mkpath(copy.dest.subpath(0, copy.dest.size()-1), 0755);
+
+ if(unlink(copy.dest.str().c_str())<0 && errno!=ENOENT)
+ {
+ int err=errno;
+ cerr<<"Can't unlink "<<copy.dest<<": "<<strerror(err)<<'\n';
+ done=error=true;
+ return;
+ }
+