Commit | Line | Data |
---|---|---|
11f96ec2 WD |
1 | --- orig/generator.c 2005-04-28 16:26:28 |
2 | +++ generator.c 2005-04-28 16:19:24 | |
3 | @@ -58,6 +58,7 @@ extern int make_backups; | |
4 | extern int csum_length; | |
5 | extern int ignore_times; | |
6 | extern int size_only; | |
7 | +extern OFF_T min_size; | |
8 | extern OFF_T max_size; | |
9 | extern int io_timeout; | |
10 | extern int io_error; | |
11 | @@ -837,6 +838,15 @@ static void recv_generator(char *fname, | |
12 | return; | |
13 | } | |
14 | ||
15 | + if (min_size && file->length < min_size) { | |
16 | + if (verbose > 1) { | |
17 | + if (the_file_list->count == 1) | |
18 | + fname = f_name(file); | |
19 | + rprintf(FINFO, "%s is under min-size\n", | |
20 | + safe_fname(fname)); | |
21 | + } | |
22 | + return; | |
23 | + } | |
24 | if (max_size && file->length > max_size) { | |
25 | if (verbose > 1) { | |
26 | if (the_file_list->count == 1) | |
27 | @@ -1239,7 +1249,7 @@ void generate_files(int f_out, struct fi | |
28 | ||
29 | phase++; | |
30 | csum_length = SUM_LENGTH; | |
31 | - only_existing = max_size = opt_ignore_existing = 0; | |
32 | + only_existing = min_size = max_size = opt_ignore_existing = 0; | |
33 | update_only = always_checksum = size_only = 0; | |
34 | ignore_times = 1; | |
35 | make_backups = 0; /* avoid a duplicate backup for inplace processing */ | |
388bf7cc | 36 | --- orig/options.c 2005-05-03 16:47:32 |
11f96ec2 WD |
37 | +++ options.c 2005-04-28 16:20:41 |
38 | @@ -98,6 +98,7 @@ int only_existing = 0; | |
39 | int opt_ignore_existing = 0; | |
40 | int need_messages_from_generator = 0; | |
41 | int max_delete = 0; | |
42 | +OFF_T min_size = 0; | |
43 | OFF_T max_size = 0; | |
44 | int ignore_errors = 0; | |
45 | int modify_window = 0; | |
46 | @@ -166,7 +167,7 @@ static int modify_window_set; | |
47 | static int itemize_changes = 0; | |
48 | static int refused_delete, refused_archive_part; | |
49 | static int refused_partial, refused_progress, refused_delete_before; | |
50 | -static char *max_size_arg; | |
51 | +static char *min_size_arg, *max_size_arg; | |
52 | static char partialdir_for_delayupdate[] = ".~tmp~"; | |
53 | ||
54 | /** Local address to bind. As a character string because it's | |
55 | @@ -307,6 +308,7 @@ void usage(enum logcode F) | |
56 | rprintf(F," --ignore-errors delete even if there are I/O errors\n"); | |
57 | rprintf(F," --force force deletion of directories even if not empty\n"); | |
58 | rprintf(F," --max-delete=NUM don't delete more than NUM files\n"); | |
59 | + rprintf(F," --min-size=SIZE don't transfer any file smaller than SIZE\n"); | |
60 | rprintf(F," --max-size=SIZE don't transfer any file larger than SIZE\n"); | |
61 | rprintf(F," --partial keep partially transferred files\n"); | |
62 | rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n"); | |
63 | @@ -364,7 +366,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP | |
64 | OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, | |
65 | OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, | |
66 | OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, | |
67 | - OPT_TIMEOUT, OPT_MAX_SIZE, | |
68 | + OPT_TIMEOUT, OPT_MIN_SIZE, OPT_MAX_SIZE, | |
69 | OPT_REFUSED_BASE = 9000}; | |
70 | ||
71 | static struct poptOption long_options[] = { | |
72 | @@ -427,6 +429,7 @@ static struct poptOption long_options[] | |
73 | {"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 }, | |
74 | {"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 }, | |
75 | {"max-delete", 0, POPT_ARG_INT, &max_delete, 0, 0, 0 }, | |
76 | + {"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 }, | |
77 | {"max-size", 0, POPT_ARG_STRING, &max_size_arg, OPT_MAX_SIZE, 0, 0 }, | |
78 | {"timeout", 0, POPT_ARG_INT, &io_timeout, OPT_TIMEOUT, 0, 0 }, | |
79 | {"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 }, | |
80 | @@ -835,6 +838,15 @@ int parse_arguments(int *argc, const cha | |
81 | read_batch = 1; | |
82 | break; | |
83 | ||
84 | + case OPT_MIN_SIZE: | |
85 | + if ((min_size = parse_size_arg(min_size_arg)) <= 0) { | |
86 | + snprintf(err_buf, sizeof err_buf, | |
87 | + "--min-size value is invalid: %s\n", | |
88 | + min_size_arg); | |
89 | + return 0; | |
90 | + } | |
91 | + break; | |
92 | + | |
93 | case OPT_MAX_SIZE: | |
94 | if ((max_size = parse_size_arg(max_size_arg)) <= 0) { | |
95 | snprintf(err_buf, sizeof err_buf, | |
96 | @@ -1352,6 +1364,11 @@ void server_options(char **args,int *arg | |
97 | args[ac++] = arg; | |
98 | } | |
99 | ||
100 | + if (min_size && am_sender) { | |
101 | + args[ac++] = "--min-size"; | |
102 | + args[ac++] = min_size_arg; | |
103 | + } | |
104 | + | |
105 | if (max_size && am_sender) { | |
106 | args[ac++] = "--max-size"; | |
107 | args[ac++] = max_size_arg; | |
388bf7cc | 108 | --- orig/rsync.yo 2005-05-03 16:47:33 |
11f96ec2 WD |
109 | +++ rsync.yo 2005-04-28 15:13:29 |
110 | @@ -350,6 +350,7 @@ to the detailed description below for a | |
111 | --ignore-errors delete even if there are I/O errors | |
112 | --force force deletion of dirs even if not empty | |
113 | --max-delete=NUM don't delete more than NUM files | |
114 | + --min-size=SIZE don't transfer any file smaller than SIZE | |
115 | --max-size=SIZE don't transfer any file larger than SIZE | |
116 | --partial keep partially transferred files | |
117 | --partial-dir=DIR put a partially transferred file into DIR | |
118 | @@ -766,6 +767,13 @@ dit(bf(--max-delete=NUM)) This tells rsy | |
119 | files or directories (NUM must be non-zero). | |
120 | This is useful when mirroring very large trees to prevent disasters. | |
121 | ||
122 | +dit(bf(--min-size=SIZE)) This tells rsync to avoid transferring any | |
123 | +file that is smaller than the specified SIZE. The SIZE value can be | |
124 | +suffixed with a letter to indicate a size multiplier (K, M, or G) and | |
125 | +may be a fractional value (e.g. "bf(--max-size=1.5m)"). | |
126 | +This can help in not transferring small junk files. | |
127 | +This only affects regular files, not e.g. device nodes or symbolic links. | |
128 | + | |
129 | dit(bf(--max-size=SIZE)) This tells rsync to avoid transferring any | |
130 | file that is larger than the specified SIZE. The SIZE value can be | |
131 | suffixed with a letter to indicate a size multiplier (K, M, or G) and |