*BSD News Article 34485


Return to BSD News archive

Xref: sserve comp.unix.bsd:14591 comp.unix.misc:13520 comp.unix.programmer:19291 comp.unix.questions:53696
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!comp.vuw.ac.nz!gphs.vuw.ac.nz!cole
From: cole@gphs.vuw.ac.nz (Robert Cole)
Newsgroups: comp.unix.bsd,comp.unix.misc,comp.unix.programmer,comp.unix.questions
Subject: Re: Q:  How can I get yesterday's date?
Date: 17 Aug 1994 22:52:48 GMT
Organization: Research School of Earth Sciences, Victoria University of Wellington, NZ
Lines: 34
Distribution: world
Message-ID: <32u4c1$nif@st-james.comp.vuw.ac.nz>
References: <Pine.3.89.9408160216.A15886-0100000@worf.uwsp.edu>
NNTP-Posting-Host: avernus.gphs.vuw.ac.nz

In article <Pine.3.89.9408160216.A15886-0100000@worf.uwsp.edu>, pzuge@worf.uwsp.edu (Peter Zuge) writes:
> I am using BSD/386 unix:
> 
> I need to create a script that will run at a certain time everyday 
> "getting" ( via ftp ) a file with yesterday's date.

How about using mtime to get the file time stamps.  For example a short
script that I use is (in pseudocode)....

#!/bin/csh
# by Robert Cole 14 Jul 1994
cd $1
# Retrieve file names of images less than 24 hours old.
set latest = `find $2 -mtime -$3 -name $4 -print`
# Get files
cp $latest .
# Remove paths from list
set latest = `echo $latest | sed s/.md.met.mcgregor.whole.pix.//g` >>& ~/gms-memo
# Process images

which is called as..

getimages dir_to_put dir_to_get time(in_days) filenames

e.g.  getimages /md/images/current /md/images/new 1 9\*.pix

Hope this helps.

Robert
-- 
Robert Cole                           \
Institute of Geophysics               |/  NZ :-)
Victoria University of Wellington    /}
PO Box 600, Wellington, New Zealand  '    cole@gphs.vuw.ac.nz