ArGest Backup User Guide

⌘K
  1. Home
  2. Docs
  3. ArGest Backup User Guide
  4. Terminal Archive Creation...
  5. Selecting Files from stdin: (-)

Selecting Files from stdin: (-)

As an alternative to specifying the files to be saved on the command line, you can provide BRU with a file that it can read, or you can pipe the output of a command to BRU and tell BRU to interpret this output as the file list. In both cases, you must use the special filename “-”. When you use a hyphen on the BRU command line in place of the files option, BRU reads the standard input stream for a list of files to process rather than collecting them from the command line. This usage takes the form:

bru -c [options] -

The special filename “-” is typically used in conjunction with a UNIX pipe or with the standard input stream redirected to a file containing a list of filenames. The two commands

cat /tmp/filelist | bru -c -PEPf -

and

bru -c -PEPf - < /tmp/filelist

are equivalent. Both create an archive of the files you have listed in filelist. Note the use of the -PEPf option, which causes BRU to expand any directories in the list. If the -PEPf is not specified, BRU will NOT expand directories, but will simply archive a single entry for each directory (just the directory name).

The following command backs up all files owned by a specific user, in this case user jim. The UNIX find command translates the symbolic user name jim to the correct user id. In this case, the -PEPf option is not needed, because the find command expands the directory and passes all the pathnames to BRU:

cd /
find . -user jim | bru -c -

Here is an alternate way to let BRU do the same thing. Since BRU is not reading a list from stdin, it will automatically expand the directories and will back up all the files owned by jim in the current and any lower directories:

bru -c -o jim /

Reading from stdin and Writing to stdout

A slightly different form of the BRU command is used when reading a list of files from stdin and writing the archive to stdout. Here’s an example:

bru -c -f - - < filelist > bru.out

where filelist contains the list of files to be saved, creates an archive with the specified files and writes it to the file bru.out. The first “-” is taken as the parameter for the -f option, specifying that the output is to be written to the standard output stream. The second “-” is taken as the special filename in place of the files arguments, and directs BRU to read the list of files to archive, from the standard input stream.