-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 05 November 2002 12:54 am, Alan Chandler wrote: > On Tuesday 05 November 2002 12:26 am, Richard Kimber wrote: > > Is there a program that will copy files from one directory to another, > > but which will avoid overwriting files with the same name by > > automatically creating a unique filename in the second directory, or is > > this > > something I need to program for myself? > > I am making this up as I go along = so its just some random thoughts > > assuming two directories like this /base/dir1 and /base/dir2 > > what about something like this (its not completely correct - it doesn't > sort out files which already have hard links) > > cp -al /base/dir2 /base2 > cp -alf /base/dir1/* /base/dir2 > find /base2/dir2 -depth -type ! d -links 2 -exec rm {} \; > > [cp -al makes a copy with hard links, cp -alf merges the two directories > and where its overwritten a file, the base2 file is left with only one > link. The find goes through the base2 directory and removes any files with > more than one link so that what you are left with there is a list of files > that were overwritten]
Actually (I don't know if this works) but I might have been too clever above cp -ab /base/dir1/* /base/dir2 might be the proper way of doing this [or cp -alfb perhaps] - -- Alan Chandler [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE9xxjDuFHxcV2FFoIRAvXIAJ4k6KVKIFlKRhBEh5GoR34FPhmPJQCffosM jrJ0IAhsEp+O+AXWroQjL/Y= =9nYn -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]