|
|
18a597 |
diff --git a/src/MirrorJob.cc b/src/MirrorJob.cc
|
|
|
18a597 |
index 595c37b..7eaea27 100644
|
|
|
18a597 |
--- a/src/MirrorJob.cc
|
|
|
18a597 |
+++ b/src/MirrorJob.cc
|
|
|
18a597 |
@@ -914,24 +914,21 @@ int MirrorJob::Do()
|
|
|
18a597 |
}
|
|
|
18a597 |
continue;
|
|
|
18a597 |
}
|
|
|
18a597 |
+ bool use_rmdir = (file->defined&file->TYPE && file->filetype==file->DIRECTORY)
|
|
|
18a597 |
+ && (flags&NO_RECURSION);
|
|
|
18a597 |
if(script)
|
|
|
18a597 |
{
|
|
|
18a597 |
- ArgV args("rm");
|
|
|
18a597 |
- if(file->defined&file->TYPE && file->filetype==file->DIRECTORY)
|
|
|
18a597 |
- {
|
|
|
18a597 |
- if(flags&NO_RECURSION)
|
|
|
18a597 |
- args.setarg(0,"rmdir");
|
|
|
18a597 |
- else
|
|
|
18a597 |
+ ArgV args(use_rmdir?"rmdir":"rm");
|
|
|
18a597 |
+ if((file->defined&file->TYPE && file->filetype==file->DIRECTORY) && !use_rmdir)
|
|
|
18a597 |
args.Append("-r");
|
|
|
18a597 |
- }
|
|
|
18a597 |
args.Append(target_session->GetFileURL(file->name));
|
|
|
18a597 |
xstring_ca cmd(args.CombineQuoted());
|
|
|
18a597 |
fprintf(script,"%s\n",cmd.get());
|
|
|
18a597 |
}
|
|
|
18a597 |
if(!script_only)
|
|
|
18a597 |
{
|
|
|
18a597 |
- ArgV *args=new ArgV("rm");
|
|
|
18a597 |
- args->Append(file->name);
|
|
|
18a597 |
+ ArgV *args=new ArgV(use_rmdir?"rmdir":"rm");
|
|
|
18a597 |
+ args->Append(dir_file(".",file->name));
|
|
|
18a597 |
args->seek(1);
|
|
|
18a597 |
rmJob *j=new rmJob(target_session->Clone(),args);
|
|
|
18a597 |
j->cmdline.set_allocated(args->Combine());
|
|
|
18a597 |
@@ -940,10 +937,7 @@ int MirrorJob::Do()
|
|
|
18a597 |
if(file->defined&file->TYPE && file->filetype==file->DIRECTORY)
|
|
|
18a597 |
{
|
|
|
18a597 |
if(flags&NO_RECURSION)
|
|
|
18a597 |
- {
|
|
|
18a597 |
- args->setarg(0,"rmdir");
|
|
|
18a597 |
j->Rmdir();
|
|
|
18a597 |
- }
|
|
|
18a597 |
else
|
|
|
18a597 |
j->Recurse();
|
|
|
18a597 |
}
|
|
|
18a597 |
@@ -1014,7 +1008,7 @@ int MirrorJob::Do()
|
|
|
18a597 |
if(!script_only)
|
|
|
18a597 |
{
|
|
|
18a597 |
ArgV *a=new ArgV("chmod");
|
|
|
18a597 |
- a->Append(file->name);
|
|
|
18a597 |
+ a->Append(dir_file(".",file->name));
|
|
|
18a597 |
a->seek(1);
|
|
|
18a597 |
ChmodJob *cj=new ChmodJob(target_session->Clone(),
|
|
|
18a597 |
file->mode&~mode_mask,a);
|