smart copy/update routine

uunet!bria!mike uunet!bria!mike
Thu Jan 31 16:53:33 AEST 1991


In an article, beard at 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 ..."



More information about the Comp.unix.misc mailing list