Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SHRINKFILE(1)		   InterNetNews Documentation		   SHRINKFILE(1)

NAME
     shrinkfile - Shrink files on line boundaries

SYNOPSIS
     shrinkfile [-nv] [-m maxsize] [-s size] file [file ...]

DESCRIPTION
     The  shrinkfile  program  shrinks	files to at most a given size when their
     size is larger than maxsize, preserving the data at the end  of  the  file.
     Truncation  is  performed	on  line boundaries, where a line is a series of
     bytes ending with a newline ("\n").  There is no  line  length  restriction
     and files may contain any binary data.

     If  the first line is longer than the absolute value of size, the file will
     be truncated to zero length.

     The maximum file size shrinkfile can handle is 2,147,483,647 bytes.

     Temporary files are created in the pathtmp directory as  set  in  inn.conf.
     The "TMPDIR" environment variable may be used to specify a different direc-
     tory.

     A newline will be added to any non-empty file that does not end with a new-
     line, if naturally the resulting file size does not exceed size by this ad-
     dition.

     This program is currently used by only nntpsend(8).

OPTIONS
     -m maxsize
	 This option sets the maximum size allowed before truncation occurs.

	 By  default, maxsize is the same as size (as set with the -s flag).  If
	 maxsize is less than size, maxsize is reset to size.

	 This parameter may end with a "k",  "m"  or  "g",  indicating	kilobyte
	 (1,024  bytes),  megabyte  (1,048,576 bytes) or gigabyte (1,073,741,824
	 bytes) lengths.  Uppercase letters are also allowed.

     -n  This flag is used to determine if any file is too large.  No files will
	 be altered in this mode.

	 Exits with status code 0 if any file is larger  than  maxsize	(as  set
	 with the -m flag), and exits with status code 1 otherwise.

     -s size
	 By  default, size is assumed to be zero and files are truncated to zero
	 bytes.  This flag may be used to change the truncation  size.	 Because
	 the  program  truncates  only on line boundaries, the final size may be
	 smaller than the specified truncation size.

	 This parameter may end with a "k",  "m"  or  "g",  indicating	kilobyte
	 (1,024  bytes),  megabyte  (1,048,576 bytes) or gigabyte (1,073,741,824
	 bytes) lengths.  Uppercase letters are also allowed.

     -v  Prints to standard output a status line if a file was shrunk.

EXAMPLES
     Example usage:

	 shrinkfile -s 4m curds
	 shrinkfile -s 1g -v whey
	 shrinkfile -s 500k -m 4m -v curds whey
	 if shrinkfile -n -s 100m whey; then echo "whey is way too big"; fi

     The first command shrinks curds to 4 MB if bigger than this size.	The sec-
     ond command shrinks whey to 1 GB and outputs a log line if the file is big-
     ger than this size.  The third command  shrinks  both  curds  and	whey  to
     500 kB  if  bigger  than  4 MB, and outputs a log line for the files it has
     shrunk.  The fourth command just prints a sentence if "whey" is bigger than
     100 MB, without shrinking it.

HISTORY
     Written   by   Landon   Curt   Noll   <chongo@toad.com>   and   Rich   $alz
     <rsalz@uunet.uu.net> for InterNetNews.  Rewritten into POD by Julien Elie.

SEE ALSO
     nntpsend(8).

INN 2.8.0			   2021-11-20			   SHRINKFILE(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=shrinkfile&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help