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

Re: can rsync correct dates?



Chris Davies <chris-usenet@roaima.co.uk> wrote:
>    find * -daystart -mtime -2 -type f |
>            cpio -ovBH ustar >/root/KEEP_THESE.tar

I have been asked off-list how this use of cpio compared to tar, and
why I wasn't using tar directly. Fair questions, so here are some answers
(for the record, really).

Despite using cpio, the output file is indeed in tar format. (Actually
it's the POSIX.1 tar format rather than the GNU format, but GNU tar can
read/write both varieties.)

I wanted to create a tarfile that contained only selected files. There
probably is a option within GNU tar to accept a list of files for
archiving but I can never remember it, and it didn't show itself during
a quick perusal of the man page.

I was also asked why I'd specified "-type f". No particular reason;
this should also work (use "-depth" so that files are created before
potentially restrictive permissions are applied to the parent directory):

    find * -depth -daystart -mtime -2 |
	    cpio -ovBH ustar >/root/KEEP_THESE.tar

Chris


Reply to: