Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!uwm.edu!ux1.cso.uiuc.edu!midway!clout!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.wizards Subject: Re: Using cp to copy only new files Message-ID: <1991Jun06.154553.18453@chinet.chi.il.us> Date: 6 Jun 91 15:45:53 GMT References: <1407@opus.NMSU.Edu> <2620002@hpcc01.HP.COM> Organization: Chinet - Chicago Public Access UNIX Lines: 21 In article <2620002@hpcc01.HP.COM> lthompso@hpcc01.HP.COM (Larry L. Thompson) writes: >>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. >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. >find . -newer -hidden -print | cpio -pudmvx Actually, cpio will already do exactly what is desired if you leave out the -u option. find . -print |cpio -pudmv dest_dir will copy all files except those that are newer or the same age on the destination directory or where there are restrictive permissions. Les Mikesell les@chinet.chi.il.us