Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2003 10:39:54 -0600
From:      "Jack L. Stone" <jackstone@sage-one.net>
To:        "Dave [Hawk-Systems]" <dave@hawk-systems.com>, <FreeBSD-questions@FreeBSD.ORG>
Subject:   Re: shell script to backup files with datestamp
Message-ID:  <3.0.5.32.20030210103954.020a3680@sage-one.net>
In-Reply-To: <DBEIKNMKGOBGNDHAAKGNKEFCIHAB.dave@hawk-systems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.
>
>Dave
>

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

Best regards,
Jack L. Stone,
Administrator

SageOne Net
http://www.sage-one.net
jackstone@sage-one.net

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?3.0.5.32.20030210103954.020a3680>