[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Copying a whole subdirectory possible?



Hi,

	The short answer is:

 # cd /path/to/old/directory
 # find . -depth -print0 | afio -p -xv -0a /mount/point/of/new/directory

	Now for the long answer. The candidates are:

cp:
        Traditionally, cp was not really a candidate since it did not
        derenference symbolic links, or preserve hard links
        either. Another thing to consider was sparse files (with
        holes).

        GNU cp has overcome these limitations, however, on a non GNU
        system, cp could still have problems. Also, you can't genrate
        small, portable archives using cp.

        % cp -a . newdir
tar:
        Tar overcame some of the problems that cp had with symbolic
        links. However, `cpio' handles special files; traditional
        `tar' doesn't. 

        `tar's way of handling multiple hard links to a file places
        only one copy of the link on the tape, but the name attached
        to that copy is the _only_ one you can use to retrieve the
        file; `cpio's way puts one copy for every link, but you can
        retrieve it using any of the names.

        % tar cf - . | (cd new-dir; tar xvvSpf -)

pax;
        The new, POSIX (IEEE Std 1003.2-1992, pages 380-388 (section
        4.48) and pages 936-940 (section E.4.48)), all singing, all
        dancing, Portable archive interchange utility.  pax will read,
        write, and list the members of an archive file, and will copy
        directory hierarchies.  pax operation is independent of the
        specific archive format, and supports a wide variety of
        different archive formats.

        pax implementations are still new and wet behind the ears.

        % pax -rw -p e . newdir
                or
        % find . -depth  | pax -rw -p e  newdir

cpio:
        copies files into or out of a cpio or tar archive, The archive
        can be another file on the disk, a magnetic tape, or a pipe. 

        % find . -depth -print0 | cpio --null --sparse -pvd new-dir

afio:
       Afio is a better way of dealing with cpio-format archives. It is
       generally faster than cpio, provides more diverse magnetic tape
       options and deals somewhat gracefully with input data corruption.  It
       deals somewhat gracefully with input data corruption.  Supports
       multi-volume archives during interactive operation.  Afio can make
       compressed archives that are much safer than compressed tar or cpio
       archives.  Afio is best used as an `archive engine' in a backup
       script.

        % find . -depth -print0 | afio -px -0a new-dir

        All my backups onto tape use afio.

        manoj

-- 
 Noncombatant: A dead Quaker. Ambrose Bierce
Manoj Srivastava   <srivasta@debian.org>  <http://www.debian.org/%7Esrivasta/>
1024R/C7261095 print CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C



Reply to: