jcb@wucs1.wustl.edu (James Christopher Beard) (01/28/91)
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. (A useful option would be to change the above "or" to an "and," so that only files already present at the target would be copied, and only if the source version were newer. As an alternative, is there source for the "newer" utility available? I have seen a man page for it, and it would allow one to write scripts with the above functionality, but I can't find source or executable. If I learn anything, I'll summarize for the net. Thanks for any help. James Beard beard@informatics.wustl.edu
boykin@encore.com (Joseph Boykin) (01/29/91)
In article <1991Jan28.155450.24449@cec1.wustl.edu>, jcb@wucs1.wustl.edu (James Christopher Beard) 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 you're using BSD there is a program called 'rdist' which will do exactly this. It is intended to be used over the network to keep several systems in sync with each other. There's nothing to prevent you from using it on the local machine. ---- Joseph Boykin Manager, Mach OS Development Encore Computer Corp Treasurer, IEEE Computer Society Internet: boykin@encore.com Phone: 508-460-0500 x2720
edw@sequent.UUCP (Ed Wright) (01/30/91)
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.
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.
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
mike (Michael Stefanik) (01/31/91)
In an article, 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. (A useful option |would be to change the above "or" to an "and," so that only files |already present at the target would be copied, and only if the source |version were newer. How 'bout this ... find src -exec find dest -newer {} -type f -print \; | sort | uniq |\ while read file; do [ -f dest/`basename $file` ] && cp $file dest; done -- Michael Stefanik | Opinions stated are not even my own. Systems Engineer, Briareus Corporation | UUCP: ...!uunet!bria!mike ------------------------------------------------------------------------------- technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly found to be saying things like "Well, it works on my DOS machine ..."
rbj@uunet.UU.NET (Root Boy Jim) (02/01/91)
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 <rbj@uunet.uu.net> Close the gap of the dark year in between
edw@sequent.UUCP (Ed Wright) (02/01/91)
In article <120740@uunet.UU.NET> rbj@uunet.UU.NET (Root Boy Jim){and which band ?} writes: %In article <51818@sequent.UUCP> edw@sequent.UUCP (Ed Wright) writes: %>In article <1991Jan28.155450.24449@cec1.wustl.edu> beard@informatics.wustl.edu writes: % %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. I could have done that, but how do I know what he running ? Certainly rdist is fine and a part of Dynix 3.1 I prefered to provide very basic ideas that would work on most flavors and let him enhance along the way. Give a man a fish .... teach him to fish .... %We'll gloss over 'args too long' or whether to use cpio for now. ^^^^^^^^^^^^^^^^ Gee Jim, I didn't know BSD supported cpio. Sounds like youve been spoiled witha dual universe OS :-) % % %You forgot Control Meta Cokebottle :-) You're just jealous :-) :-) 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
les@chinet.chi.il.us (Leslie Mikesell) (02/04/91)
In article <1991Jan28.155450.24449@cec1.wustl.edu> beard@informatics.wustl.edu writes: >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. find source_dir -print |cpio -pdm target_dir Cpio will not overwrite a newer file unless you use the -u option. Les Mikesell les@chinet.chi.il.us
mitch@hq.af.mil (Mitch Wright) (02/04/91)
>%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. make(1) should be able to do this. -- ..mitch mitch@hq.af.mil (Mitch Wright) | The Pentagon, 1B1046 | (703) 695-0262 ``A system without PERL is like a hockey game without a fight.'' -- Mitch Wright