Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* help with a little script
@ 2005-06-30 12:46 mabus
  2005-06-30 12:53 ` J. Lievisse Adriaanse
  0 siblings, 1 reply; 4+ messages in thread
From: mabus @ 2005-06-30 12:46 UTC (permalink / raw)


Hi there,

i need someone to help me with a little script i have to run in my
machine:

each day a process generates more than 5000 archives in a directory and
i need to move all the archives (1 day old) to another directory, and
make a tar file with them; if the archives have a name like this:
*YYYYMMDD*, how do i create a script that moves them and make a tar
with this format *YYYYMMDD*.tar ???

tks
Mabus



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

* Re: help with a little script
  2005-06-30 12:46 help with a little script mabus
@ 2005-06-30 12:53 ` J. Lievisse Adriaanse
  2005-06-30 13:18   ` mabus
  0 siblings, 1 reply; 4+ messages in thread
From: J. Lievisse Adriaanse @ 2005-06-30 12:53 UTC (permalink / raw)


What kind of script do you want? Perl or SH or what ?

Jasper

On 30 Jun 2005 05:46:08 -0700
"mabus" <mateo.monsalve@gmail.com> wrote:

> Hi there,
> 
> i need someone to help me with a little script i have to run in my
> machine:
> 
> each day a process generates more than 5000 archives in a directory and
> i need to move all the archives (1 day old) to another directory, and
> make a tar file with them; if the archives have a name like this:
> *YYYYMMDD*, how do i create a script that moves them and make a tar
> with this format *YYYYMMDD*.tar ???
> 
> tks
> Mabus
> 




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

* Re: help with a little script
  2005-06-30 12:53 ` J. Lievisse Adriaanse
@ 2005-06-30 13:18   ` mabus
  2005-07-01 10:01     ` J. Lievisse Adriaanse
  0 siblings, 1 reply; 4+ messages in thread
From: mabus @ 2005-06-30 13:18 UTC (permalink / raw)


i need to use a sh script



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

* Re: help with a little script
  2005-06-30 13:18   ` mabus
@ 2005-07-01 10:01     ` J. Lievisse Adriaanse
  0 siblings, 0 replies; 4+ messages in thread
From: J. Lievisse Adriaanse @ 2005-07-01 10:01 UTC (permalink / raw)


Ok, this one should work. I have tested it on my OpenBSD laptop, but you probaly have to adjust the variables (especially date, since it differs per OS). You have to make sure that the $DESTDIR has been created before running the script.

#!/bin/sh
#
# J. Lievisse Adriaanse, 2005, BSD-license. 
# Purpose: A quick backup script for Mabus.
#

TEMPDIR=/tmp/archives
DESTDIR=/var/backup/tar/
ORIGDIR=/home/mabus/archives/
FNAME='/bin/date +%Y-%m-%d'

mkdir $TEMPDIR

cd $ORIGDIR
for i in `/bin/ls`; do
	mv $i $TEMPDIR
done

cd $TEMPDIR
tar -cf `$FNAME`.tar *
mv `$FNAME`.tar $DESTDIR
rm -fr $TEMPDIR


Cheers,
Jasper



On 30 Jun 2005 06:18:57 -0700
"mabus" <mateo.monsalve@gmail.com> wrote:

> i need to use a sh script
> 




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

end of thread, other threads:[~2005-07-01 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-30 12:46 help with a little script mabus
2005-06-30 12:53 ` J. Lievisse Adriaanse
2005-06-30 13:18   ` mabus
2005-07-01 10:01     ` J. Lievisse Adriaanse

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