From owner-freebsd-questions@FreeBSD.ORG Sun Jan 9 23:08:38 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1263B16A4CF for ; Sun, 9 Jan 2005 23:08:38 +0000 (GMT) Received: from smtp1.wanadoo.fr (smtp1.wanadoo.fr [193.252.22.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id C14C643D45 for ; Sun, 9 Jan 2005 23:08:37 +0000 (GMT) (envelope-from atkielski.anthony@wanadoo.fr) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf0103.wanadoo.fr (SMTP Server) with ESMTP id 6CFAA1F9270E for ; Mon, 10 Jan 2005 00:08:36 +0100 (CET) Received: from pix.atkielski.com (ASt-Lambert-111-2-1-3.w81-50.abo.wanadoo.fr [81.50.80.3]) by mwinf0103.wanadoo.fr (SMTP Server) with ESMTP id 47F8C1F926E2 for ; Mon, 10 Jan 2005 00:08:36 +0100 (CET) Date: Mon, 10 Jan 2005 00:08:35 +0100 From: Anthony Atkielski X-Priority: 3 (Normal) Message-ID: <14545951.20050110000835@wanadoo.fr> To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Copying directory trees only for new files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Jan 2005 23:08:38 -0000 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