www.delorie.com/gnu/docs/tar/tar_91.html   search  
 
Buy GNU books!


GNU tar

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

NUL Terminated File Names

The --null option causes --files-from=file-of-names (-T file-of-names) to read file names terminated by a NUL instead of a newline, so files whose names contain newlines can be archived using `--files-from'.

--null
Only consider NUL terminated file names, instead of files that terminate in a newline.

The `--null' option is just like the one in GNU xargs and cpio, and is useful with the `-print0' predicate of GNU find. In tar, `--null' also causes --directory=directory (-C directory) options to be treated as file names to archive, in case there are any files out there called `-C'.

This example shows how to use find to generate a list of files larger than 800K in length and put that list into a file called `long-files'. The `-print0' option to find just just like `-print', except that it separates files with a NUL rather than with a newline. You can then run tar with both the `--null' and `-T' options to specify that tar get the files from that file, `long-files', to create the archive `big.tgz'. The `--null' option to tar will cause tar to recognize the NUL separator between files.

 
$ find . -size +800 -print0 > long-files
$ tar -c -v --null --files-from=long-files --file=big.tar

@quote-arg


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)