added --existing option, similar to one suggested by Gildas Quiniou <gildas@stip.fr>
[rsync/rsync.git] / generator.c
index 3f6322f..cb63f72 100644 (file)
@@ -178,6 +178,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
        extern char *compare_dest;
        extern int list_only;
        extern int preserve_perms;
+       extern int only_existing;
 
        if (list_only) return;
 
@@ -186,6 +187,12 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
 
        statret = link_stat(fname,&st);
 
+       if (only_existing && statret == -1 && errno == ENOENT) {
+               /* we only want to update existing files */
+               if (verbose > 1) rprintf(FINFO,"not creating %s\n",fname);
+               return;
+       }
+
        if (statret == 0 && 
            !preserve_perms && 
            (S_ISDIR(st.st_mode) == S_ISDIR(file->mode))) {