Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!uw-beaver!mit-eddie!wuarchive!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.unix.misc Subject: Re: smart copy/update routine Message-ID: <120740@uunet.UU.NET> Date: 31 Jan 91 20:18:23 GMT References: <1991Jan28.155450.24449@cec1.wustl.edu> <51818@sequent.UUCP> Organization: UUNET Communications Services, Falls Church, VA Lines: 49 In article <51818@sequent.UUCP> edw@sequent.UUCP (Ed Wright) writes: >In article <1991Jan28.155450.24449@cec1.wustl.edu> beard@informatics.wustl.edu writes: >%Is there such a thing available as unix source? What I need is a >%program that can be told to copy files from source to target iff the >%file to be copied does not exist on the target or the source version >%is newer than the version in the target directory. If Sequent would get hip to 4.3, than Ed would be recommending rdist. It maintains exact copies with identical contents/owner/group/mode/dates. If you don't have it, it's in our archives. You need sockets to run it. >make a timestamp file >run find on your your filesystem looking for files newer than timestamp >let the result of the find be an argument to tar as filename >and tar cBf - $filename | (cd /newplace;tar xpBf -) >When you're done touch timestamp >Then you're ready for next time. I assume you mean something like (cd $from; tar cBf - `find . -newer stamp -print` ) | \ (cd $to; tar xpBf - ) touch stamp We'll gloss over 'args too long' or whether to use cpio for now. You left a window, by doing the obvious thing. You will miss files modified between the find and the touch. You need two timestamp file. This leaves a window too, copying some files twice. touch newstamp find $where -newer stamp -print > list mv newstamp stamp use cpio/tar/whatever to backup files named in list Of course, the files we copy could be being modified in either case. >Ed >-- > I think I've got the hang of it now .... :w :q :wq :wq! ^d X exit > X Q :quitbye CtrlAltDel ~~q :~q logout save/quit :!QUIT ^[zz > ^[ZZ ZZZZ ^H ^@ ^L ^[c ^# ^E ^X ^I ^T ? help helpquit ^D ^d > ^C ^c helpexit ?Quit ?q ^Kx /QY sync;halt KA9AHQ edw@sequent.com You forgot Control Meta Cokebottle :-) -- Root Boy Jim Cottrell Close the gap of the dark year in between