Using cp to copy only new files

Larry L. Thompson lthompso at hpcc01.HP.COM
Thu Jun 6 05:48:34 AEST 1991


>I would like to run a simple shell program to archive data files from
>my hard disk to an optical disk.  I would like for the archived files
>to be directly usable from the archive (i.e. tar is no good).  Hence,
>what I would like is some way to use the cp command with a qualifier
>that says don't re-copy files that already exist - only new ones.
>
>Either that, or a 'since date' option.  Or something similar.  Any
>suggestions??  Thanks!
>
>Bryan Emery
>Computer Systems Analyst
>Lockheed Engineering and Sciences Corp
>White Sands Test Facility
>----------
>
OK this is a two step process. You first need to touch a file somewhere
that will be used as the reference data for filtering files that are newer
than itself. 

Now just use this file along with the find command piped into cpio. Like
this:

find . -newer <filename> -hidden -print | cpio -pudmvx <destination>


Larry
------------------------------------------------------------------------------
Larry L. Thompson                       Hewlett-Packard Co.  
Unix:   lthompso at hpcmfs.corp.hp.com     3500 Deer Creek Rd 26U-13
HPDesk: larry_l_thompson at hp0000         Palo Alto, CA.  94304
Tel: (415) 857-4437                     Un-employed



More information about the Comp.unix.wizards mailing list