tar: recurse

1 
1 6.9 Descending into Directories
1 ===============================
1 
1 Usually, 'tar' will recursively explore all directories (either those
1 given on the command line or through the '--files-from' option) for the
1 various files they contain.  However, you may not always want 'tar' to
1 act this way.
1 
1    The '--no-recursion' option inhibits 'tar''s recursive descent into
1 specified directories.  If you specify '--no-recursion', you can use the
1 'find' (⇒find (find)Top.) utility for hunting through levels of
1 directories to construct a list of file names which you could then pass
1 to 'tar'.  'find' allows you to be more selective when choosing which
1 files to archive; see ⇒files, for more information on using
1 'find' with 'tar'.
1 
1 '--no-recursion'
1      Prevents 'tar' from recursively descending directories.
1 
1 '--recursion'
1      Requires 'tar' to recursively descend directories.  This is the
1      default.
1 
1    When you use '--no-recursion', GNU 'tar' grabs directory entries
1 themselves, but does not descend on them recursively.  Many people use
1 'find' for locating files they want to back up, and since 'tar'
1 _usually_ recursively descends on directories, they have to use the
11 '-not -type d' test in their 'find' invocation (⇒Type
 (find)Type.), as they usually do not want all the files in a directory.
1 They then use the '--files-from' option to archive the files located via
1 'find'.
1 
1    The problem when restoring files archived in this manner is that the
1 directories themselves are not in the archive; so the
1 '--same-permissions' ('--preserve-permissions', '-p') option does not
1 affect them--while users might really like it to.  Specifying
1 '--no-recursion' is a way to tell 'tar' to grab only the directory
1 entries given to it, adding no new files on its own.  To summarize, if
1 you use 'find' to create a list of files to be stored in an archive, use
1 it as follows:
1 
1      $ find DIR TESTS | \
1        tar -cf ARCHIVE --no-recursion -T -
1 
1    The '--no-recursion' option also applies when extracting: it causes
1 'tar' to extract only the matched directory entries, not the files under
1 those directories.
1 
1    The '--no-recursion' option also affects how globbing patterns are
1 interpreted (⇒controlling pattern-matching).
1 
1    The '--no-recursion' and '--recursion' options apply to later options
1 and operands, and can be overridden by later occurrences of
1 '--no-recursion' and '--recursion'.  For example:
1 
1      $ tar -cf jams.tar --no-recursion grape --recursion grape/concord
1 
1 creates an archive with one entry for 'grape', and the recursive
1 contents of 'grape/concord', but no entries under 'grape' other than
1 'grape/concord'.
1