added --size-only option. Useful when starting to use rsync after a
authorAndrew Tridgell <tridge@samba.org>
Thu, 18 Feb 1999 03:48:24 +0000 (03:48 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 18 Feb 1999 03:48:24 +0000 (03:48 +0000)
ftp based mirror system so that timestamps may not be right.

generator.c
options.c
rsync.yo

index b772d33..1be4717 100644 (file)
@@ -31,6 +31,7 @@ extern int whole_file;
 extern int block_size;
 extern int csum_length;
 extern int ignore_times;
+extern int size_only;
 extern int io_timeout;
 extern int remote_version;
 extern int always_checksum;
@@ -52,6 +53,10 @@ static int skip_file(char *fname,
                return (memcmp(sum,file->sum,csum_length) == 0);
        }
 
+       if (size_only) {
+               return 1;
+       }
+
        if (ignore_times) {
                return 0;
        }
index 6757144..aff2a3a 100644 (file)
--- a/options.c
+++ b/options.c
@@ -61,6 +61,7 @@ int keep_partial=0;
 int safe_symlinks=0;
 int copy_unsafe_links=0;
 int block_size=BLOCK_SIZE;
+int size_only=0;
 
 char *backup_suffix = BACKUP_SUFFIX;
 char *tmpdir = NULL;
@@ -127,6 +128,7 @@ void usage(int F)
   rprintf(F,"     --numeric-ids           don't map uid/gid values by user/group name\n");
   rprintf(F,"     --timeout=TIME          set IO timeout in seconds\n");
   rprintf(F," -I, --ignore-times          don't exclude files that match length and time\n");
+  rprintf(F,"     --size-only             only use file size when determining if a file should be transferred\n");
   rprintf(F," -T  --temp-dir=DIR          create temporary files in directory DIR\n");
   rprintf(F,"     --compare-dest=DIR      also compare destination files relative to DIR\n");
   rprintf(F," -z, --compress              compress file data\n");
@@ -155,7 +157,7 @@ enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
       OPT_FORCE,OPT_TIMEOUT,OPT_DAEMON,OPT_CONFIG,OPT_PORT,
       OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_STATS, OPT_PARTIAL, OPT_PROGRESS,
       OPT_COPY_UNSAFE_LINKS, OPT_SAFE_LINKS, OPT_COMPARE_DEST,
-      OPT_LOG_FORMAT, OPT_PASSWORD_FILE};
+      OPT_LOG_FORMAT, OPT_PASSWORD_FILE, OPT_SIZE_ONLY};
 
 static char *short_options = "oblLWHpguDCtcahvqrRIxnSe:B:T:z";
 
@@ -174,6 +176,7 @@ static struct option long_options[] = {
   {"password-file", 1, 0,     OPT_PASSWORD_FILE},
   {"one-file-system",0,  0,    'x'},
   {"ignore-times",0,     0,    'I'},
+  {"size-only",   0,     0,    OPT_SIZE_ONLY},
   {"help",        0,     0,    'h'},
   {"dry-run",     0,     0,    'n'},
   {"sparse",      0,     0,    'S'},
@@ -289,10 +292,15 @@ int parse_arguments(int argc, char *argv[], int frommain)
                case OPT_PASSWORD_FILE:
                        password_file =optarg;
                        break;          
+
                case 'I':
                        ignore_times = 1;
                        break;
 
+               case OPT_SIZE_ONLY:
+                       size_only = 1;
+                       break;
+
                case 'x':
                        one_file_system=1;
                        break;
@@ -586,6 +594,9 @@ void server_options(char **args,int *argc)
        if (delete_mode)
                args[ac++] = "--delete";
 
+       if (size_only)
+               args[ac++] = "--size-only";
+
        if (keep_partial)
                args[ac++] = "--partial";
 
index 3d3eee5..5bcbc31 100644 (file)
--- a/rsync.yo
+++ b/rsync.yo
@@ -255,6 +255,7 @@ Options
      --numeric-ids           don't map uid/gid values by user/group name
      --timeout=TIME          set IO timeout in seconds
  -I, --ignore-times          don't exclude files that match length and time
+     --size-only             only use file size when determining if a file should be transferred
  -T  --temp-dir=DIR          create temporary files in directory DIR
      --compare-dest=DIR      also compare destination files relative to DIR
  -z, --compress              compress file data
@@ -304,6 +305,13 @@ dit(bf(-I, --ignore-times)) Normally rsync will skip any files that are
 already the same length and have the same time-stamp. This option turns
 off this behavior.
 
+dit(bf(-I, --size-only)) Normally rsync will skip any files that are
+already the same length and have the same time-stamp. With the
+--size-only option files will be skipped if they have the same size,
+regardless of timestamp. This is useful when starting to use rsync
+after using another mirroring system which may not preserve timestamps
+exactly.
+
 dit(bf(-c, --checksum)) This forces the sender to checksum all files using
 a 128-bit MD4 checksum before transfer. The checksum is then
 explicitly checked on the receiver and any files of the same name