1SHRINKFILE(1) InterNetNews Documentation SHRINKFILE(1)
2
3
4
6 shrinkfile - Shrink files on line boundaries
7
9 shrinkfile [-nv] [-m maxsize] [-s size] file [file ...]
10
12 The shrinkfile program shrinks files to at most a given size when their
13 size is larger than maxsize, preserving the data at the end of the
14 file. Truncation is performed on line boundaries, where a line is a
15 series of bytes ending with a newline ("\n"). There is no line length
16 restriction and files may contain any binary data.
17
18 If the first line is longer than the absolute value of size, the file
19 will be truncated to zero length.
20
21 The maximum file size shrinkfile can handle is 2,147,483,647 bytes.
22
23 Temporary files are created in the pathtmp directory as set in
24 inn.conf. The "TMPDIR" environment variable may be used to specify a
25 different directory.
26
27 A newline will be added to any non-empty file that does not end with a
28 newline, if naturally the resulting file size does not exceed size by
29 this addition.
30
31 This program is currently used by only nntpsend(8).
32
34 -m maxsize
35 This option sets the maximum size allowed before truncation occurs.
36
37 By default, maxsize is the same as size (as set with the -s flag).
38 If maxsize is less than size, maxsize is reset to size.
39
40 This parameter may end with a "k", "m" or "g", indicating kilobyte
41 (1,024 bytes), megabyte (1,048,576 bytes) or gigabyte
42 (1,073,741,824 bytes) lengths. Uppercase letters are also allowed.
43
44 -n This flag is used to determine if any file is too large. No files
45 will be altered in this mode.
46
47 Exits with status code 0 if any file is larger than maxsize (as set
48 with the -m flag), and exits with status code 1 otherwise.
49
50 -s size
51 By default, size is assumed to be zero and files are truncated to
52 zero bytes. This flag may be used to change the truncation size.
53 Because the program truncates only on line boundaries, the final
54 size may be smaller than the specified truncation size.
55
56 This parameter may end with a "k", "m" or "g", indicating kilobyte
57 (1,024 bytes), megabyte (1,048,576 bytes) or gigabyte
58 (1,073,741,824 bytes) lengths. Uppercase letters are also allowed.
59
60 -v Prints to standard output a status line if a file was shrunk.
61
63 Example usage:
64
65 shrinkfile -s 4m curds
66 shrinkfile -s 1g -v whey
67 shrinkfile -s 500k -m 4m -v curds whey
68 if shrinkfile -n -s 100m whey; then echo "whey is way too big"; fi
69
70 The first command shrinks curds to 4 MB if bigger than this size. The
71 second command shrinks whey to 1 GB and outputs a log line if the file
72 is bigger than this size. The third command shrinks both curds and
73 whey to 500 kB if bigger than 4 MB, and outputs a log line for the
74 files it has shrunk. The fourth command just prints a sentence if
75 "whey" is bigger than 100 MB, without shrinking it.
76
78 Written by Landon Curt Noll <chongo@toad.com> and Rich $alz
79 <rsalz@uunet.uu.net> for InterNetNews. Rewritten into POD by Julien
80 Elie.
81
83 nntpsend(8).
84
85
86
87INN 2.7.1 2022-07-10 SHRINKFILE(1)