From owner-freebsd-questions Mon Feb 10 8:48:19 2003 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 7274037B401 for ; Mon, 10 Feb 2003 08:48:17 -0800 (PST) Received: from galilee.polands.org (new-24-208-57-240.new.rr.com [24.208.57.240]) by mx1.FreeBSD.org (Postfix) with ESMTP id 924CB43F85 for ; Mon, 10 Feb 2003 08:48:16 -0800 (PST) (envelope-from doug@polands.org) Received: from mydomain.com (samaria.polands.org [172.16.1.17]) by galilee.polands.org (8.12.6/8.12.6) with SMTP id h1AGmFIl072264; Mon, 10 Feb 2003 10:48:15 -0600 (CST) (envelope-from doug@polands.org) Received: from 63.104.35.130 (proxying for 164.5.45.79) (SquirrelMail authenticated user djp) by email.polands.org with HTTP; Mon, 10 Feb 2003 10:48:15 -0600 (CST) Message-ID: <49206.63.104.35.130.1044895695.squirrel@email.polands.org> Date: Mon, 10 Feb 2003 10:48:15 -0600 (CST) Subject: Re: shell script to backup files with datestamp From: "Doug Poland" To: In-Reply-To: <3.0.5.32.20030210103954.020a3680@sage-one.net> References: <3.0.5.32.20030210103954.020a3680@sage-one.net> X-Priority: 3 Importance: Normal Cc: , X-Mailer: SquirrelMail (version 1.2.8) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Jack L. Stone said: >> At 11:19 AM 2.10.2003 -0500, Dave [Hawk-Systems] wrote: >> Without dumping to perl or another external language, would like >> to accomplish the following; >> >> prior to making changes in a file, backup incrementially the >> current file to create a record of changes ans versions. For >> example. >> >> we are about to make changes to file.conf and would like to make >> a copy of our current file before doing so *without* overwriting >> previous backup copies >> >> #cp /path/to/file.conf /path/to/file.conf.20030210 >> >> I almost want to say this could be done with something simple >> like >> >> #cp /path/to/file.conf /path/to/file.conf.$DATE >> >> which would be the solution if I was using perl, php, or soething >> else to accomplish the copy of files, but would prefer a simple >> one liner without having to load another processor just for this >> one command. >> >>Suggestions would be appreciated. >> > > If you use "date" as follows, it will take it out to the month, > day, hour and minute > > cp ../file.conf`date +".%m.%d.%H.%M"` > > ...will give: > file.conf.02.06.04.45 > I suggest spending an hour or two learning RCS. You'll have history, rollback, tags, and much more with a real revision control system. RCS is not at all hard to learn with basic checkin (ci) checkout (co) and diff (rcsdiff) commands. Any time you spend learning RCS will help if you later have to move to CVS for a distributed solution. -- Regards, Doug To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message