Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jan 2005 00:08:35 +0100
From:      Anthony Atkielski <atkielski.anthony@wanadoo.fr>
To:        freebsd-questions@freebsd.org
Subject:   Copying directory trees only for new files
Message-ID:  <14545951.20050110000835@wanadoo.fr>

next in thread | raw e-mail | index | archive | help
What's the safest and most elegant way to copy an entire directory tree
such that only newer files and directories are actually copied?

Essentially I have one directory that contains my test version of my Web
site, and another directory that contains the production version of the
site.  Normally the two directories are mirror images of each other.
When I update one or more files in the test tree, I want to have some
easy and safe way to copy the test tree to the production tree--but for
efficiency's sake, I only want to actually physically copy the data for
a file or directory if the source version has been modified more
recently than the destination version.

The cp command looks like it would do the trick, except it doesn't
appear to have any option that copies only newer files and directories.

I suspect there are probably a dozen or more UNIX commands that do this
sort of thing, and/or perhaps some FreeBSD-specific commands that do it
as well. Any suggestions on which commands to look at?

If I can get this to work cleanly and in a straightforward way I may be
able to liberate myself from the creaky old copy of Visual InterDev that
I use for Web development.  UltraEdit (which I use on Windows) will let
me edit files directly to and from an FTP destination, so I could use
that to make my changes, then use a magic command to copy the changed
files from the test tree to the production tree once I've tested them.

-- 
Anthony




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