Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2002 04:16:37 +0200
From:      Matthias Buelow <mkb@mukappabeta.de>
To:        Peter Leftwich <Hostmaster@Video2Video.Com>
Cc:        FreeBSD LIST <FreeBSD-Questions@FreeBSD.Org>
Subject:   Re: mv vs. tar [pax isn't just a tv channel]
Message-ID:  <20020530021637.GA867@altair.mukappabeta.net>
In-Reply-To: <20020529212825.T78044-100000@earl-grey.cloud9.net>
References:  <20020530012023.GB593@altair.mukappabeta.net> <20020529212825.T78044-100000@earl-grey.cloud9.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Leftwich writes:

>Hm, I'd never heard of "pax -rw" but then again, things involving "cpio"
>and "rcp" and "scp" scare the pants off my pants!  So my question is...

(yes, that's why I use pax :)

>does pax or any other cp or mv command in FreeBSD "intelligently zip
>together" a directory when the same name already exists?  For example:
>
>$ mv /this/here/directory /this/new/location/
>
>...where /this/new/location/directory/ already exists, and so this command
>line would "weave" new files into the existing directory rather than
>complaining about its presence (and possibly as a bonus, favor the 'oldest'
>ctime modification information).  Did I lose y'all?

pax' got a few options, including not to overwrite existing files
(-k, see manpage) etc.  You could easily check if the wanted behaviour
is there by trying it out on a small test set.  In general, if you
don't specify any options, it is my understanding that it clobbers
existing files (haven't verified that, you can easily check for
yourself anyways.)

The copy mode of pax (for copying file hierarchies between directories
or filesystems on the same machine) basically looks like:
    cd /source; pax -rw . /path/to/target

(that's the way I always bulk-copy directory hierarchies.) The
initial cd is required because otherwise, if you would specify the
full pathname of the source to pax, it would recreate that hierarchy
(starting with the full pathname of the source) below the target
directory, which is probably undesired.  The advantage here is that
nothing is converted into an archive format, or piped to another
process, like it would be with tar.  pax just acts as a file copying
utility in that mode (preserving file modes and ownership, file
timestamps, even resetting access times.) You can also tell pax to
just create symlinks instead of copying files, which also may have
its application.  Another advantage is that pax works the same way
on any system it is found on (within the limits of its definition
by the standard, of course,) unlike tar or cpio, which may vary a
lot between different operating systems, especially older commercial
ones.

--mkb


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020530021637.GA867>