Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Filename as date
@ 2000-05-17  4:00 Tom Mc Carrick
  2000-05-17  4:00 ` jean-paul Fermiger
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Mc Carrick @ 2000-05-17  4:00 UTC (permalink / raw)


I need to set up a daily entry in the root crontab file which will do a
simple backup operation, copying a directory from one location to another.
The trick is that the destination file will have the format 'DDMMYY' which
is the date that it executes.
                                 I have tried a few methods, the nearest I
got was
 (e.g. 'cp -R /usr/tmp /usr/tmp/`date +%A` ) which will name the destination
file after the day e.g. 'Tuesday'. (The -R switch is to create a new
directory)
      But I haven't got it in the required format (DDMMYY). Is there a
better way to do this?
     Will it involve some sort of command substitution with `date` as above?

Regards - Tom






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Filename as date
  2000-05-17  4:00 Filename as date Tom Mc Carrick
@ 2000-05-17  4:00 ` jean-paul Fermiger
  2000-05-17  4:00   ` Timo Felbinger
  0 siblings, 1 reply; 3+ messages in thread
From: jean-paul Fermiger @ 2000-05-17  4:00 UTC (permalink / raw)


Tom Mc Carrick wrote:

> I need to set up a daily entry in the root crontab file which will do a
> simple backup operation, copying a directory from one location to another.
> The trick is that the destination file will have the format 'DDMMYY' which
> is the date that it executes.
>                                  I have tried a few methods, the nearest I
> got was
>  (e.g. 'cp -R /usr/tmp /usr/tmp/`date +%A` ) which will name the destination
> file after the day e.g. 'Tuesday'. (The -R switch is to create a new
> directory)
>       But I haven't got it in the required format (DDMMYY). Is there a
> better way to do this?
>      Will it involve some sort of command substitution with `date` as above?
>
> Regards - Tom

Try :  cp -R /usr/tmp /usr/tmp/`date +%d%m%y`

    Regards





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Filename as date
  2000-05-17  4:00 ` jean-paul Fermiger
@ 2000-05-17  4:00   ` Timo Felbinger
  0 siblings, 0 replies; 3+ messages in thread
From: Timo Felbinger @ 2000-05-17  4:00 UTC (permalink / raw)



On Wed, 17 May 2000, jean-paul Fermiger wrote:

> Tom Mc Carrick wrote:
> 
> > I need to set up a daily entry in the root crontab file which will do a
> > simple backup operation, copying a directory from one location to another.
> > The trick is that the destination file will have the format 'DDMMYY' which
> > is the date that it executes.
> >                                  I have tried a few methods, the nearest I
> > got was
> >  (e.g. 'cp -R /usr/tmp /usr/tmp/`date +%A` ) which will name the destination
> > file after the day e.g. 'Tuesday'. (The -R switch is to create a new
> > directory)
> >       But I haven't got it in the required format (DDMMYY). Is there a
> > better way to do this?
> >      Will it involve some sort of command substitution with `date` as above?
> >
> > Regards - Tom
> 
> Try :  cp -R /usr/tmp /usr/tmp/`date +%d%m%y`
> 

... and to avoid a common mistake from last century, you should
consider using

   cp -R /usr/tmp /usr/tmp/`date +%d%m%Y`

instead. Bytes aren't that expensive anymore. If you expect to collect
many such files, you might even prefer

   cp -R /usr/tmp /usr/tmp/`date +%Y%m%d`

so the filenames can easily be sorted in chronological order.

Regards,

Timo Felbinger

-- 
Timo Felbinger           <Timo.Felbinger@quantum.physik.uni-potsdam.de>
Quantum Physics Group    http://www.quantum.physik.uni-potsdam.de/TF
Institut fuer Physik     Tel: +49 331 977 1793      Fax: -1767
Universitaet Potsdam, Germany





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-05-17  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-05-17  4:00 Filename as date Tom Mc Carrick
2000-05-17  4:00 ` jean-paul Fermiger
2000-05-17  4:00   ` Timo Felbinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox